Set the parsing type
authorGreg Burri <greg.burri@gmail.com>
Mon, 22 Mar 2021 21:45:18 +0000 (22:45 +0100)
committerGreg Burri <greg.burri@gmail.com>
Mon, 22 Mar 2021 21:45:18 +0000 (22:45 +0100)
backend/src/valheim_controller.rs

index f8bcbed..6fa6c7f 100644 (file)
@@ -108,9 +108,9 @@ fn get_active_players() -> Vec<String> {
                         else if let Some(pos) = mess.find(STRING_BEFORE_NB_OF_CONNECTIONS) {\r
                             let nb_of_connections_str = mess.get(pos+STRING_BEFORE_NB_OF_CONNECTIONS.len()+1..).unwrap();\r
                             if let Some(pos_end) = nb_of_connections_str.find(' ') {\r
-                                if let Ok(n) = nb_of_connections_str.get(0..pos_end).unwrap().parse() {\r
+                                if let Ok(n) = nb_of_connections_str.get(0..pos_end).unwrap().parse::<i32>() {\r
                                     if number_of_connections == -1 {\r
-                                        number_of_connections = n as i32;\r
+                                        number_of_connections = n;\r
 \r
                                         if players.len() as i32 >= number_of_connections {\r
                                             return players;\r