Skip to content

Commit 861abb9

Browse files
SuGliderCopilot
andauthored
feat(midi): explicit safer test and return
Co-authored-by: Copilot <[email protected]>
1 parent c14e769 commit 861abb9

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

libraries/USB/src/USBMIDI.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,11 @@ const char* USBMIDI::getCurrentDeviceName(void) {
103103
}
104104
// If no user name set, use the compile-time default name limited to 32 characters
105105
setDeviceName(getUSBMIDIDefaultDeviceName());
106-
return strlen(midiUserDeviceName) ? midiUserDeviceName : "TinyUSB MIDI";
106+
if (midiUserDeviceName && strlen(midiUserDeviceName)) {
107+
return midiUserDeviceName;
108+
} else {
109+
return "TinyUSB MIDI";
110+
}
107111
}
108112

109113
// uint compatible version of constrain

0 commit comments

Comments
 (0)