Просмотр исходного кода

ncd: modules: ref: silently fail resolving an empty object. This avoids printing false positive errors
about object resolution failure when a method is called on ref().

ambrop7 14 лет назад
Родитель
Сommit
116294cacc
1 измененных файлов с 12 добавлено и 0 удалено
  1. 12 0
      ncd/modules/ref.c

+ 12 - 0
ncd/modules/ref.c

@@ -122,6 +122,12 @@ static NCDModuleInst * refhere_func_getobj (void *vo, const char *objname)
 {
     struct refhere_instance *o = vo;
     
+    // We don't redirect methods, and there will never be an object
+    // with empty name. Fail here so we don't report non-errors.
+    if (!strcmp(objname, "")) {
+        return 0;
+    }
+    
     return NCDModuleInst_Backend_GetObj(o->i, objname);
 }
 
@@ -206,6 +212,12 @@ static NCDModuleInst * ref_func_getobj (void *vo, const char *objname)
 {
     struct ref_instance *o = vo;
     
+    // We don't redirect methods, and there will never be an object
+    // with empty name. Fail here so we don't report non-errors.
+    if (!strcmp(objname, "")) {
+        return 0;
+    }
+    
     return NCDModuleInst_Backend_GetObj(o->rh->i, objname);
 }