guards in place for when scoreboard_host.txt is not present

This commit is contained in:
Haze Weathers 2024-12-03 16:08:33 -05:00
parent 6a68e025ea
commit 94ed6c6c68
3 changed files with 11 additions and 5 deletions

View file

@ -77,6 +77,12 @@ func _refresh_scores() -> void:
func _load_scores(level: String) -> void:
loaded_scores[level] = {}
if ScoreBoard.server_host.empty():
yield(get_tree(), "idle_frame")
return
var result: Dictionary = yield(ScoreBoard.get_scores(level), "completed")
if ScoreBoard.errored:
#TODO: failure indication
@ -86,7 +92,6 @@ func _load_scores(level: String) -> void:
_sorting_dict = result
players.sort_custom(self, "_sort_scores")
loaded_scores[level] = {}
for p in players:
loaded_scores[level][p] = result[p]