Fixed segfault that happend when you'd exit the ingame-state.
This commit is contained in:
11
src/main.c
11
src/main.c
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user