瀏覽代碼

Fix dereference after null check

Stefan Profanter 7 年之前
父節點
當前提交
28f225eb70
共有 1 個文件被更改,包括 3 次插入2 次删除
  1. 3 2
      src/server/ua_services_call.c

+ 3 - 2
src/server/ua_services_call.c

@@ -68,10 +68,11 @@ Operation_CallMethod(UA_Server *server, UA_Session *session,
         (const UA_MethodNode*)UA_NodeStore_get(server->nodestore, &request->methodId);
     if(!methodCalled)
         result->statusCode = UA_STATUSCODE_BADMETHODINVALID;
-    if(methodCalled->nodeClass != UA_NODECLASS_METHOD)
+    else if(methodCalled->nodeClass != UA_NODECLASS_METHOD)
         result->statusCode = UA_STATUSCODE_BADNODECLASSINVALID;
-    if(!methodCalled->attachedMethod)
+    else if(!methodCalled->attachedMethod)
         result->statusCode = UA_STATUSCODE_BADINTERNALERROR;
+
     if(result->statusCode != UA_STATUSCODE_GOOD)
         return;