Hopefully fix 3 crashes (#341)

* Hopefully fix 3 crashes
This commit is contained in:
Agent X 2023-04-10 10:31:45 -07:00 committed by GitHub
parent 318807d3c2
commit 265a3c6b03
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 13 additions and 1 deletions

View file

@ -161,6 +161,10 @@ u32 get_mario_spawn_type(struct Object *o) {
}
struct ObjectWarpNode *area_get_warp_node(u8 id) {
if (gCurrentArea == NULL || gCurrentArea->warpNodes == NULL) {
return NULL;
}
struct ObjectWarpNode *node = NULL;
for (node = gCurrentArea->warpNodes; node != NULL; node = node->next) {

View file

@ -332,6 +332,11 @@ static void open_mod_file(struct Mod* mod, struct ModFile* file) {
}
void network_receive_download(struct Packet* p) {
if (p == NULL) {
LOG_ERROR("Received null packet");
return;
}
SOFT_ASSERT(gNetworkType == NT_CLIENT);
if (p->localIndex != UNKNOWN_LOCAL_INDEX) {
if (gNetworkPlayerServer == NULL || gNetworkPlayerServer->localIndex != p->localIndex) {

View file

@ -28,7 +28,10 @@ void network_send_mod_list_request(void) {
}
void network_receive_mod_list_request(UNUSED struct Packet* p) {
SOFT_ASSERT(gNetworkType == NT_SERVER);
if (gNetworkType != NT_SERVER) {
LOG_ERROR("Network type should be server!");
return;
}
LOG_INFO("received mod list request");
network_send_mod_list();