Skip to content

Commit

Permalink
fix: don't panic when username is less than 10 chars (#193)
Browse files Browse the repository at this point in the history
  • Loading branch information
TestingPlant authored Apr 9, 2024
1 parent 54efba4 commit bb9c3d2
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion crates/server/src/net.rs
Original file line number Diff line number Diff line change
Expand Up @@ -386,7 +386,8 @@ impl Io {
let username = username.0;

// trim username to 10 chars
let username = username[..10].to_owned();
let username_len = std::cmp::min(username.len(), 10);
let username = &username[..username_len];

// add 2 random chars to the end of the username
let username = format!(
Expand Down

0 comments on commit bb9c3d2

Please sign in to comment.