mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-11-04 01:11:36 +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;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (port == nullptr) {
|
||||||
|
PX4_ERR("no device specified");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
/* create the driver */
|
/* create the driver */
|
||||||
g_dev = new SF0X(port, rotation);
|
g_dev = new SF0X(port, rotation);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user