check for invalid gate configs

This commit is contained in:
Nordup 2025-08-20 00:29:40 +07:00
parent e74e2479bd
commit 5b4cacfcc4
2 changed files with 7 additions and 1 deletions

View file

@ -21,6 +21,12 @@ var libraries: PackedStringArray
func _init(path: String, base_url: String) -> void: func _init(path: String, base_url: String) -> void:
super._init(path) super._init(path)
if not SECTION in get_sections():
Debug.logclr("Invalid gate config file: don't have section " + SECTION, Color.YELLOW)
load_result = ERR_INVALID_DATA
return
title = get_string(SECTION, KEY_TITLE) title = get_string(SECTION, KEY_TITLE)
description = get_string(SECTION, KEY_DESCRIPTION) description = get_string(SECTION, KEY_DESCRIPTION)
icon_url = Url.join(base_url, get_string(SECTION, KEY_ICON)) icon_url = Url.join(base_url, get_string(SECTION, KEY_ICON))

View file

@ -119,7 +119,7 @@ func on_gate_error(code: GateEvents.GateError) -> void:
GateEvents.GateError.NOT_FOUND: GateEvents.GateError.NOT_FOUND:
set_progress("Gate not found", ProgressStatus.ERROR) set_progress("Gate not found", ProgressStatus.ERROR)
GateEvents.GateError.INVALID_CONFIG: GateEvents.GateError.INVALID_CONFIG:
set_progress("Invalid gate config", ProgressStatus.ERROR) set_progress("Gate not found", ProgressStatus.ERROR)
GateEvents.GateError.MISSING_PACK, GateEvents.GateError.MISSING_LIBS: GateEvents.GateError.MISSING_PACK, GateEvents.GateError.MISSING_LIBS:
set_progress("Cannot load gate resources", ProgressStatus.ERROR) set_progress("Cannot load gate resources", ProgressStatus.ERROR)
_: _: