mirror of
https://github.com/PX4/PX4-Autopilot.git
synced 2026-05-22 06:14:14 +08:00
fix sf0x: check if device port is given
otherwise we risk dereferencing a null pointer
This commit is contained in:
@@ -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);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user