servo: NULL pointer check for servo constructors
The servo constructors might return a NULL pointer. The function servo_create() uses servo without checks. Signed-off-by: Burkhard Ilsen <burkhardilsen@gmail.com>master
parent
ac92a71161
commit
7e1ccac8f8
3
servo.c
3
servo.c
|
@ -52,6 +52,9 @@ struct servo *servo_create(struct config *cfg, enum servo_type type,
|
|||
return NULL;
|
||||
}
|
||||
|
||||
if (!servo)
|
||||
return NULL;
|
||||
|
||||
servo_step_threshold = config_get_double(cfg, NULL, "step_threshold");
|
||||
if (servo_step_threshold > 0.0) {
|
||||
servo->step_threshold = servo_step_threshold * NSEC_PER_SEC;
|
||||
|
|
Loading…
Reference in New Issue