projects
/
minecraft_web.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
e4d360b
)
Remove empty nicks from the 'list' command.
author
Greg Burri
<greg.burri@gmail.com>
Sun, 27 Jun 2021 09:20:28 +0000
(11:20 +0200)
committer
Greg Burri
<greg.burri@gmail.com>
Sun, 27 Jun 2021 09:20:28 +0000
(11:20 +0200)
backend/src/minecraft_controller.rs
patch
|
blob
|
history
diff --git
a/backend/src/minecraft_controller.rs
b/backend/src/minecraft_controller.rs
index
a644c4d
..
9287cda
100644
(file)
--- a/
backend/src/minecraft_controller.rs
+++ b/
backend/src/minecraft_controller.rs
@@
-88,8
+88,13
@@
fn get_status_from_rcon(rcon_password: &str) -> StatusFromRcon {
match client.send_command("list".to_string()) {
\r
Ok(resp) =>
\r
match resp.body.find(':') {
\r
match client.send_command("list".to_string()) {
\r
Ok(resp) =>
\r
match resp.body.find(':') {
\r
- Some(i) => resp.body[i + 1..resp.body.len() - 1].split(',').map(|nick| nick.trim().to_string()).collect(),
\r
- None => Vec::new()
\r
+ Some(i) if i < resp.body.len() -1 =>
\r
+ resp.body[i + 1..resp.body.len() - 1]
\r
+ .split(',')
\r
+ .map(|nick| nick.trim().to_string())
\r
+ .filter(|nick| !nick.is_empty())
\r
+ .collect(),
\r
+ _ => Vec::new()
\r
},
\r
Err(_e) => {
\r
println!("Error from 'list' command");
\r
},
\r
Err(_e) => {
\r
println!("Error from 'list' command");
\r