usermod udp_name_sync : properly initialize packet if segment name is empty
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
This commit is contained in:
parent
2082b01a3c
commit
f3e3f585df
@ -36,13 +36,14 @@ class UdpNameSync : public Usermod {
|
|||||||
byte udpOut[WLED_MAX_SEGNAME_LEN + 2];
|
byte udpOut[WLED_MAX_SEGNAME_LEN + 2];
|
||||||
udpOut[0] = 2; // 0: wled notifier protocol, 1: warls protocol, 2 is free
|
udpOut[0] = 2; // 0: wled notifier protocol, 1: warls protocol, 2 is free
|
||||||
|
|
||||||
if (strlen(segmentName) && !mainseg.name) { //name is back to null
|
if (strlen(segmentName) && !mainseg.name) { // name cleared
|
||||||
notifierUdp.beginPacket(broadcastIp, udpPort);
|
notifierUdp.beginPacket(broadcastIp, udpPort);
|
||||||
strcpy(segmentName,"");
|
segmentName[0] = '\0';
|
||||||
DEBUG_PRINTLN(F("UdpNameSync: sending Null name"));
|
DEBUG_PRINTLN(F("UdpNameSync: sending empty name"));
|
||||||
notifierUdp.write( udpOut , 2);
|
udpOut[1] = 0; // explicit empty string
|
||||||
notifierUdp.endPacket();
|
notifierUdp.write(udpOut, 2);
|
||||||
return;
|
notifierUdp.endPacket();
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const char* curName = mainseg.name ? mainseg.name : "";
|
const char* curName = mainseg.name ? mainseg.name : "";
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user