瀏覽代碼

check result of split in find_device_target

Fredrik Svantesson 6 年之前
父節點
當前提交
d75c5d4c9c
共有 1 個檔案被更改,包括 5 行新增1 行删除
  1. 5
    1
      src/light.c

+ 5
- 1
src/light.c 查看文件

604
 light_device_target_t* light_find_device_target(light_context_t *ctx, char const * name)
604
 light_device_target_t* light_find_device_target(light_context_t *ctx, char const * name)
605
 {
605
 {
606
     light_target_path_t new_path;
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
     Uncomment to debug the split function
614
     Uncomment to debug the split function