[ONOS-6247] Fix for Misplaced null check for YdtContext object

Change-Id: I052957b7db9c893d4db4691ebd933c23028b5dab
diff --git a/protocols/restconf/server/utils/src/main/java/org/onosproject/protocol/restconf/server/utils/parser/json/ParserUtils.java b/protocols/restconf/server/utils/src/main/java/org/onosproject/protocol/restconf/server/utils/parser/json/ParserUtils.java
index 87a3d51..c00e265 100644
--- a/protocols/restconf/server/utils/src/main/java/org/onosproject/protocol/restconf/server/utils/parser/json/ParserUtils.java
+++ b/protocols/restconf/server/utils/src/main/java/org/onosproject/protocol/restconf/server/utils/parser/json/ParserUtils.java
@@ -564,15 +564,16 @@
                 ydtNode = ydtNode.getFirstChild();
             }
 
+            if (ydtNode == null) {
+                // There is no more node to find in YDT
+                return null;
+            }
+
             if (((YdtExtendedContext) ydtNode).getYdtContextOperationType() != NONE) {
                 // We found last node
                 break;
             }
 
-            if (ydtNode == null) {
-                // There is no more node to find in YDT
-                return null;
-            }
 
             opType = ((YdtExtendedContext) ydtNode).getYdtContextOperationType();
         }