mirror of
https://github.com/coop-deluxe/sm64coopdx.git
synced 2025-10-30 08:01:01 +00:00
fix client crash when incompatible tag is null (#300)
* rerun autogen * give clients access to mod incompatible tags And fix a crash when warping to the cake end picture * whoops * fix client crash
This commit is contained in:
parent
a22f930d27
commit
ac5204d46b
1 changed files with 12 additions and 4 deletions
|
|
@ -67,7 +67,11 @@ void network_send_mod_list(void) {
|
||||||
packet_write(&p, &nameLength, sizeof(u16));
|
packet_write(&p, &nameLength, sizeof(u16));
|
||||||
packet_write(&p, mod->name, sizeof(u8) * nameLength);
|
packet_write(&p, mod->name, sizeof(u8) * nameLength);
|
||||||
packet_write(&p, &incompatibleLength, sizeof(u16));
|
packet_write(&p, &incompatibleLength, sizeof(u16));
|
||||||
packet_write(&p, mod->incompatible, sizeof(u8) * incompatibleLength);
|
if (mod->incompatible) {
|
||||||
|
packet_write(&p, mod->incompatible, sizeof(u8) * incompatibleLength);
|
||||||
|
} else {
|
||||||
|
packet_write(&p, "", 0);
|
||||||
|
}
|
||||||
packet_write(&p, &relativePathLength, sizeof(u16));
|
packet_write(&p, &relativePathLength, sizeof(u16));
|
||||||
packet_write(&p, mod->relativePath, sizeof(u8) * relativePathLength);
|
packet_write(&p, mod->relativePath, sizeof(u8) * relativePathLength);
|
||||||
packet_write(&p, &modSize, sizeof(u64));
|
packet_write(&p, &modSize, sizeof(u64));
|
||||||
|
|
@ -196,9 +200,13 @@ void network_receive_mod_list_entry(struct Packet* p) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// get incompatible
|
// get incompatible
|
||||||
char incompatible[32] = { 0 };
|
if (incompatibleLength > 0) {
|
||||||
packet_read(p, incompatible, incompatibleLength * sizeof(u8));
|
char incompatible[32] = { 0 };
|
||||||
mod->incompatible = strdup(incompatible);
|
packet_read(p, incompatible, incompatibleLength * sizeof(u8));
|
||||||
|
mod->incompatible = strdup(incompatible);
|
||||||
|
} else {
|
||||||
|
packet_read(p, 0, 0);
|
||||||
|
}
|
||||||
|
|
||||||
// get other fields
|
// get other fields
|
||||||
u16 relativePathLength = 0;
|
u16 relativePathLength = 0;
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue