libicsneoc: Fixed access violation

add-device-sharing
David Rebbe 2022-11-07 20:22:45 +00:00
parent 5ff1707c47
commit de58b2d639
1 changed files with 5 additions and 0 deletions

View File

@ -486,6 +486,11 @@ bool icsneo_describeDevice(const neodevice_t* device, char* str, size_t* maxLeng
if(!icsneo_isValidNeoDevice(device)) if(!icsneo_isValidNeoDevice(device))
return false; return false;
if(!str) {
*maxLength = device->device->describe().length();
return false;
}
std::string output = device->device->describe(); std::string output = device->device->describe();
*maxLength = output.copy(str, *maxLength); *maxLength = output.copy(str, *maxLength);