Fix InstanceIdentifier.getAncestor() implementations
[yangtools.git] / data / yang-data-api / src / main / java / org / opendaylight / yangtools / yang / data / api / StackedYangInstanceIdentifier.java
index 955ef2543eebe13c6682b91c4bc85d20b537a15d..c8ff903394400ed140e2e1d8e777ace5e4954c83 100644 (file)
@@ -9,6 +9,7 @@ package org.opendaylight.yangtools.yang.data.api;
 
 import static com.google.common.base.Preconditions.checkArgument;
 import static com.google.common.base.Verify.verify;
+import static com.google.common.base.Verify.verifyNotNull;
 import static java.util.Objects.requireNonNull;
 
 import com.google.common.collect.Iterables;
@@ -101,7 +102,7 @@ final class StackedYangInstanceIdentifier extends YangInstanceIdentifier impleme
         final int toWalk = ourDepth - depth;
         YangInstanceIdentifier result = this;
         for (int i = 0; i < toWalk; ++i) {
-            result = result.getParent();
+            result = verifyNotNull(result.getParent());
         }
 
         return result;