mirror of
https://gitlab.com/dosowisko.net/libsuperderpy.git
synced 2025-02-08 06:06:43 +01:00
fix potential crash shown by clang-tidy warning
This commit is contained in:
parent
74e2d863b9
commit
1c2e27f2b7
1 changed files with 5 additions and 1 deletions
|
@ -295,7 +295,7 @@ SYMBOL_INTERNAL bool OpenGamestate(struct Game* game, struct Gamestate* gamestat
|
||||||
}
|
}
|
||||||
|
|
||||||
SYMBOL_INTERNAL bool LinkGamestate(struct Game* game, struct Gamestate* gamestate) {
|
SYMBOL_INTERNAL bool LinkGamestate(struct Game* game, struct Gamestate* gamestate) {
|
||||||
gamestate->api = malloc(sizeof(struct Gamestate_API));
|
gamestate->api = calloc(1, sizeof(struct Gamestate_API));
|
||||||
|
|
||||||
#define GS_ERROR \
|
#define GS_ERROR \
|
||||||
FatalError(game, false, "Error on resolving gamestate's %s symbol: %s", gamestate->name, dlerror()); /* TODO: move out */ \
|
FatalError(game, false, "Error on resolving gamestate's %s symbol: %s", gamestate->name, dlerror()); /* TODO: move out */ \
|
||||||
|
@ -552,8 +552,12 @@ SYMBOL_INTERNAL void ResumeExecution(struct Game* game) {
|
||||||
if (tmp->api->Gamestate_Reload) {
|
if (tmp->api->Gamestate_Reload) {
|
||||||
tmp->api->Gamestate_Reload(game, tmp->data);
|
tmp->api->Gamestate_Reload(game, tmp->data);
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
// live-reload failed
|
||||||
|
tmp->loaded = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!tmp->paused && tmp->loaded && tmp->api->Gamestate_Resume) {
|
if (!tmp->paused && tmp->loaded && tmp->api->Gamestate_Resume) {
|
||||||
tmp->api->Gamestate_Resume(game, tmp->data);
|
tmp->api->Gamestate_Resume(game, tmp->data);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue