diff --git a/src/game/area.c b/src/game/area.c index 3401634b..bb1688af 100644 --- a/src/game/area.c +++ b/src/game/area.c @@ -161,9 +161,7 @@ u32 get_mario_spawn_type(struct Object *o) { } struct ObjectWarpNode *area_get_warp_node(u8 id) { - if (gCurrentArea == NULL || gCurrentArea->warpNodes == NULL) { - return NULL; - } + if (!gCurrentArea || !gCurrentArea->warpNodes) { return NULL; } struct ObjectWarpNode *node = NULL; diff --git a/src/game/interaction.c b/src/game/interaction.c index f8739cc2..1e90acc3 100644 --- a/src/game/interaction.c +++ b/src/game/interaction.c @@ -1353,6 +1353,8 @@ u8 player_is_sliding(struct MarioState* m) { } u8 passes_pvp_interaction_checks(struct MarioState* attacker, struct MarioState* victim) { + if (!attacker || !victim) { return false; } + // attacked u8 isInCutscene = ((attacker->action & ACT_GROUP_MASK) == ACT_GROUP_CUTSCENE) || ((victim->action & ACT_GROUP_MASK) == ACT_GROUP_CUTSCENE); isInCutscene = isInCutscene || (attacker->action == ACT_IN_CANNON) || (victim->action == ACT_IN_CANNON); diff --git a/src/game/object_helpers.c b/src/game/object_helpers.c index 49084d1d..42d5326a 100644 --- a/src/game/object_helpers.c +++ b/src/game/object_helpers.c @@ -2664,7 +2664,10 @@ s32 cur_obj_move_up_and_down(s32 a0) { } void cur_obj_call_action_function(void (*actionFunctions[])(void)) { + if (!actionFunctions) { return; } + void (*actionFunction)(void) = actionFunctions[o->oAction]; + if (!actionFunction) { return; } actionFunction(); } diff --git a/src/pc/network/packets/packet_download.c b/src/pc/network/packets/packet_download.c index 81bdffe2..de5a4a94 100644 --- a/src/pc/network/packets/packet_download.c +++ b/src/pc/network/packets/packet_download.c @@ -332,7 +332,7 @@ static void open_mod_file(struct Mod* mod, struct ModFile* file) { } void network_receive_download(struct Packet* p) { - if (p == NULL) { + if (!p) { LOG_ERROR("Received null packet"); return; }