Add null check for return value of stlink_chipid_get_params()

Pass a null pointer to "%s" is undefined behaviour.
pull/1307/head
Mingjie Shen 2023-04-22 00:53:29 -04:00
rodzic 8de2b4dcfa
commit 98902c271e
1 zmienionych plików z 2 dodań i 1 usunięć

Wyświetl plik

@ -591,7 +591,8 @@ int main(int argc, char **argv) {
if (!(stlink->chip_flags & CHIP_F_HAS_SWO_TRACING)) {
const struct stlink_chipid_params *params =
stlink_chipid_get_params(stlink->chip_id);
ELOG("We do not support SWO output for device '%s'\n", params->dev_type);
ELOG("We do not support SWO output for device '%s'\n",
params ? params->dev_type : "");
if (!settings.force)
return APP_RESULT_STLINK_UNSUPPORTED_DEVICE;
}