diff BUGFIX orig-default meta is mandatory for leaf replace
diff --git a/src/diff.c b/src/diff.c
index 7285211..c2e3935 100644
--- a/src/diff.c
+++ b/src/diff.c
@@ -1550,10 +1550,7 @@
     uint32_t flag1, flag2;
 
     meta = lyd_find_meta(node->meta, mod, "orig-default");
-    if (!meta) {
-        /* default flag did not change */
-        return LY_SUCCESS;
-    }
+    LY_CHECK_ERR_RET(!meta, LOGINT(mod->ctx), LY_EINT);
 
     /* orig-default */
     if (meta->value.boolean) {
@@ -1565,6 +1562,11 @@
     /* current default */
     flag2 = node->flags & LYD_DEFAULT;
 
+    if (flag1 == flag2) {
+        /* no default state change so nothing to reverse */
+        return LY_SUCCESS;
+    }
+
     /* switch defaults */
     node->flags &= ~LYD_DEFAULT;
     node->flags |= flag1;