Przeglądaj źródła

check result of split in find_device_target

Fredrik Svantesson 6 lat temu
rodzic
commit
d75c5d4c9c
1 zmienionych plików z 5 dodań i 1 usunięć
  1. 5
    1
      src/light.c

+ 5
- 1
src/light.c Wyświetl plik

@@ -604,7 +604,11 @@ bool light_split_target_path(char const *in_path, light_target_path_t *out_path)
604 604
 light_device_target_t* light_find_device_target(light_context_t *ctx, char const * name)
605 605
 {
606 606
     light_target_path_t new_path;
607
-    light_split_target_path(name, &new_path);
607
+    if(!light_split_target_path(name, &new_path))
608
+    {
609
+        LIGHT_WARN("light_find_device_target needs a path in the format of \"enumerator/device/target\", the following format is not recognized:  \"%s\"", name);
610
+        return NULL;
611
+    }
608 612
     
609 613
     /*
610 614
     Uncomment to debug the split function