mirror of
https://github.com/LostArtefacts/TRX.git
synced 2025-04-28 20:58:07 +03:00
tr2/shell: fix crash when exiting with -l
This commit is contained in:
parent
655bd311fb
commit
92837a07c9
2 changed files with 6 additions and 5 deletions
|
@ -98,11 +98,7 @@ typedef struct {
|
|||
typedef struct {
|
||||
int32_t num;
|
||||
GF_LEVEL_TYPE type;
|
||||
#if TR_VERSION == 1
|
||||
char *path;
|
||||
#elif TR_VERSION == 2
|
||||
const char *path;
|
||||
#endif
|
||||
char *title;
|
||||
|
||||
MUSIC_TRACK_ID music_track;
|
||||
|
|
|
@ -393,7 +393,9 @@ void Shell_Main(void)
|
|||
GameBuf_Init();
|
||||
|
||||
if (level_to_play != nullptr) {
|
||||
g_GameFlow.level_tables[GFLT_MAIN].levels[0].path = level_to_play;
|
||||
Memory_Free(g_GameFlow.level_tables[GFLT_MAIN].levels[0].path);
|
||||
g_GameFlow.level_tables[GFLT_MAIN].levels[0].path =
|
||||
Memory_DupStr(level_to_play);
|
||||
}
|
||||
|
||||
GF_COMMAND gf_cmd = level_to_play != nullptr
|
||||
|
@ -468,6 +470,9 @@ void Shell_Main(void)
|
|||
}
|
||||
|
||||
Config_Write();
|
||||
if (level_to_play != nullptr) {
|
||||
Memory_FreePointer(&g_GameFlow.level_tables[GFLT_MAIN].levels[0].path);
|
||||
}
|
||||
}
|
||||
|
||||
void Shell_Shutdown(void)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue