fix sf0x: check if device port is given

otherwise we risk dereferencing a null pointer
This commit is contained in:
Beat Küng 2020-03-02 14:49:13 +01:00 committed by Daniel Agar
parent bbe15aa61a
commit 5a26f06f8a
1 changed files with 5 additions and 0 deletions

View File

@ -48,6 +48,11 @@ static int start(const char *port, uint8_t rotation)
return -1;
}
if (port == nullptr) {
PX4_ERR("no device specified");
return -1;
}
/* create the driver */
g_dev = new SF0X(port, rotation);