mirror of
https://github.com/coop-deluxe/sm64coopdx.git
synced 2024-11-21 19:45:10 +00:00
Fix segfault when comparing mods
This commit is contained in:
parent
c18413ed2a
commit
f9a144b6c1
2 changed files with 5 additions and 2 deletions
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in a new issue