mirror of
https://gitlab.com/dosowisko.net/libsuperderpy.git
synced 2024-12-05 00:38:00 +01:00
timeline: gracefullly handle out of bounds indexes in TM_GetArg
This commit is contained in:
parent
9706f61116
commit
1e7fe215c4
2 changed files with 6 additions and 2 deletions
|
@ -26,7 +26,7 @@ static void DestroyArgs(struct TM_Arguments* args) {
|
|||
}
|
||||
}
|
||||
|
||||
SYMBOL_EXPORT struct Timeline* TM_Init(struct Game* game, struct GamestateResources* data, char* name) {
|
||||
SYMBOL_EXPORT struct Timeline* TM_Init(struct Game* game, struct GamestateResources* data, const char* name) {
|
||||
PrintConsole(game, "Timeline Manager[%s]: init", name);
|
||||
struct Timeline* timeline = malloc(sizeof(struct Timeline));
|
||||
timeline->game = game;
|
||||
|
@ -373,8 +373,12 @@ SYMBOL_EXPORT struct TM_Arguments* TM_AddToArgs(struct TM_Arguments* args, int n
|
|||
}
|
||||
|
||||
SYMBOL_EXPORT void* TM_GetArg(struct TM_Arguments* args, int num) {
|
||||
if (!args) { return NULL; }
|
||||
for (int i = 0; i < num; i++) {
|
||||
args = args->next;
|
||||
if (!args) {
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
return args->value;
|
||||
}
|
||||
|
|
|
@ -68,7 +68,7 @@ struct TM_Action {
|
|||
};
|
||||
|
||||
/*! \brief Init timeline. */
|
||||
struct Timeline* TM_Init(struct Game* game, struct GamestateResources* data, char* name);
|
||||
struct Timeline* TM_Init(struct Game* game, struct GamestateResources* data, const char* name);
|
||||
|
||||
/*! \brief Process current timeline actions. */
|
||||
void TM_Process(struct Timeline*, double delta);
|
||||
|
|
Loading…
Reference in a new issue