added ASSERT_RETURN to playerinput constructor

This commit is contained in:
Sara 2023-11-22 15:12:32 +01:00
parent 5d8d996c91
commit 51b889c6ef

View file

@ -1,7 +1,9 @@
#include "player_input.h" #include "player_input.h"
#include "debug.h"
PlayerInput* playerinput_new(void* target, int device) { PlayerInput* playerinput_new(void* target, int device) {
PlayerInput* self = malloc(sizeof(PlayerInput)); PlayerInput* self = malloc(sizeof(PlayerInput));
ASSERT_RETURN(self != NULL, NULL, "Could not allocate memory for PlayerInput instance");
self->listeners = list_from_type(InputListener); self->listeners = list_from_type(InputListener);
self->device = input_get_device_by_id(device); self->device = input_get_device_by_id(device);
self->target = target; self->target = target;