This is an automated email from the ASF dual-hosted git repository.

aokolnychyi pushed a commit to branch 0.10.x
in repository https://gitbox.apache.org/repos/asf/iceberg.git

commit de0d9cca2e5c9da6d13263ec465a9853c6b6294f
Author: Jungtaek Lim <[email protected]>
AuthorDate: Fri Nov 6 10:02:10 2020 +0900

    Core: Fix NPE in SnapshotManager.validateCurrentSnapshot (#1725)
---
 core/src/main/java/org/apache/iceberg/SnapshotManager.java | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/core/src/main/java/org/apache/iceberg/SnapshotManager.java 
b/core/src/main/java/org/apache/iceberg/SnapshotManager.java
index 93ae46f..a663e06 100644
--- a/core/src/main/java/org/apache/iceberg/SnapshotManager.java
+++ b/core/src/main/java/org/apache/iceberg/SnapshotManager.java
@@ -235,7 +235,7 @@ public class SnapshotManager extends 
MergingSnapshotProducer<ManageSnapshots> im
   }
 
   private static void validateCurrentSnapshot(TableMetadata meta, Long 
requiredSnapshotId) {
-    if (requiredSnapshotId != null) {
+    if (requiredSnapshotId != null && meta.currentSnapshot() != null) {
       ValidationException.check(meta.currentSnapshot().snapshotId() == 
requiredSnapshotId,
           "Cannot fast-forward to non-append snapshot; current has changed: 
current=%s != required=%s",
           meta.currentSnapshot().snapshotId(), requiredSnapshotId);

Reply via email to