Skip to content

Commit 6193abb

Browse files
committed
[UI] Make the InitializeUI() method of Settings class return a success value
Sanity check if the Settings UI has been successfully initialized. And if not, rollback the initialization process and unload the mod!
1 parent 582ff23 commit 6193abb

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

COTLMP/Ui/Settings.cs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ private static bool AddSetting(SETTING_TYPE Type, string SettingName, string Val
196196
* Initializes the Settings UI of the mod during the
197197
* startup of the mod.
198198
*/
199-
public static void InitializeUI()
199+
public static bool InitializeUI()
200200
{
201201
bool Success;
202202
ActionCallbacks Callbacks;
@@ -214,7 +214,7 @@ public static void InitializeUI()
214214
{
215215
COTLMP.Debug.PrintLogger.Print(DebugLevel.ERROR_LEVEL, DebugComponent.UI_COMPONENT,
216216
"Failed to add the Game Modes setting, expect problems with mod initialization!");
217-
return;
217+
return Success;
218218
}
219219

220220
/* Add the "Players Count" setting */
@@ -230,7 +230,7 @@ public static void InitializeUI()
230230
{
231231
COTLMP.Debug.PrintLogger.Print(DebugLevel.ERROR_LEVEL, DebugComponent.UI_COMPONENT,
232232
"Failed to add the Players Count setting, expect problems with mod initialization!");
233-
return;
233+
return Success;
234234
}
235235

236236
/* Add the "Enable Voice Chat" setting */
@@ -245,8 +245,10 @@ public static void InitializeUI()
245245
{
246246
COTLMP.Debug.PrintLogger.Print(DebugLevel.ERROR_LEVEL, DebugComponent.UI_COMPONENT,
247247
"Failed to add the Voice Chat setting, expect problems with mod initialization!");
248-
return;
248+
return Success;
249249
}
250+
251+
return Success;
250252
}
251253
}
252254
}

0 commit comments

Comments
 (0)