cortex-command-community / Cortex-Command-Community-Project-Source

[ARCHIVED] Cortex Command - Open Source under GNU AGPL v3 (no game data included)

Home Page:https://cortex-command-community.github.io/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

`LaunchIntoActivity` with a bad `DefaultSceneName` crashes without error report

traunts opened this issue · comments

Describe the bug
When a user has set the settings.ini property LaunchIntoActivity and specified an invalid DefaultSceneName, the game will hard crash on load without providing any feedback to the user. No RTEA Error message or otherwise.

To Reproduce
Steps to reproduce the behaviour:
Edit the settings.ini file to contain the following lines:

...
////////////////////////////////////////////////////////////////////////
// Default Activity Settings

	LaunchIntoActivity = 1
	DefaultActivityType = GAScripted
	DefaultActivityName = Test Activity
	DefaultSceneName = INVALID < ---- 

...

and launch the game. You'll hear the MenuEnter sound, as though the edit menu has opened, and the game will crash without an error display.

This can occur when launching into a modded scene that is no longer present, or if a user mistypes the name of an existing scene.

Expected behaviour
The game should inform the user that the DefaultSceneName is invalid, or at the very least indicate that the activity failed to restart and give a user-readable abort message.

Better yet, should default to the main menu and open the console to fail gracefully.

Screenshots
The offending line from debug:
image

Where the BuyMenu create is never called (missing this check):
image

This is a result of GameActivity::Start() returning early due to a non-zero exit status from the chain:
GameActivity::Start() -> Activity::Start() -> SceneMan::LoadScene() -> SceneMan:SetSceneToLoad(m_DefaultSceneName) where the sceneRef fails to load and is null.

All of these propagate an error return status of -1 up the stack, and several prints to console, but none call RTEAssert().
Likely because these are used to load/reload an activity in-game (as well as on load), where the action can be aborted and errors displayed in the console, whereas there's no functionality for that here.