Fixed segfault that happend when you'd exit the ingame-state.

This commit is contained in:
2025-12-11 18:37:40 +01:00
parent f4404457ee
commit 0045d2788c
4 changed files with 11 additions and 9 deletions

View File

@@ -1,5 +1,6 @@
#include <stdlib.h>
#include <assert.h>
#include <stdio.h>
#include "presentation/states/state_ingame.h"
#include "presentation/states/state_main_menu.h"
@@ -29,18 +30,16 @@ int main() {
break;
}
Presentation_State *state = presentation_state_machine.current;
// Tick.
if(state != NULL && state->tick != NULL) {
state->tick(state);
if(presentation_state_machine.current != NULL && presentation_state_machine.current->tick != NULL) {
presentation_state_machine.current->tick(presentation_state_machine.current);
}
// Render.
BeginDrawing();
{
if(state != NULL && state->render != NULL) {
state->render(state);
if(presentation_state_machine.current != NULL && presentation_state_machine.current->render != NULL) {
presentation_state_machine.current->render(presentation_state_machine.current);
}
}
EndDrawing();