diff --git a/src/pc/network/packets/packet_join.c b/src/pc/network/packets/packet_join.c index 6db81996..31aee61f 100644 --- a/src/pc/network/packets/packet_join.c +++ b/src/pc/network/packets/packet_join.c @@ -151,7 +151,7 @@ void network_receive_join(struct Packet* p) { string_builder_append(builder, "\\#c8c8c8\\Yours: "); struct StringLinkedList* node = &gRegisteredMods; bool first = true; - while (node != NULL) { + while (node != NULL && node->string != NULL) { string_builder_append(builder, first ? "\\#%s\\%s" : ", \\#%s\\%s", string_linked_list_contains(&head, node->string) ? "a0ffa0" : "ffa0a0" , node->string); @@ -162,7 +162,7 @@ void network_receive_join(struct Packet* p) { string_builder_append(builder, "\n\n\\#c8c8c8\\Theirs: "); node = &head; first = true; - while (node != NULL) { + while (node != NULL && node->string != NULL) { string_builder_append(builder, first ? "\\#%s\\%s" : ", \\#%s\\%s", string_linked_list_contains(&gRegisteredMods, node->string) ? "a0ffa0" : "ffa0a0" , node->string); diff --git a/src/pc/utils/string_linked_list.c b/src/pc/utils/string_linked_list.c index ef795aea..b81dcf59 100644 --- a/src/pc/utils/string_linked_list.c +++ b/src/pc/utils/string_linked_list.c @@ -21,6 +21,9 @@ void string_linked_list_append(struct StringLinkedList* node, char* string) { } bool string_linked_list_contains(struct StringLinkedList* node, char* string) { + if (string == NULL) { + return false; + } int length1 = strlen(string); while (node != NULL && node->string != NULL) { int length2 = strlen(node->string);