From 546b668502030d7ad8a873e33df048bb1541620c Mon Sep 17 00:00:00 2001 From: zzz Date: Wed, 24 Aug 2011 18:03:56 +0000 Subject: [PATCH] fix NPE after corruption ticket #515 --- core/java/src/net/metanotion/io/block/index/IBSkipSpan.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/core/java/src/net/metanotion/io/block/index/IBSkipSpan.java b/core/java/src/net/metanotion/io/block/index/IBSkipSpan.java index ffca8306f..03ca4475e 100644 --- a/core/java/src/net/metanotion/io/block/index/IBSkipSpan.java +++ b/core/java/src/net/metanotion/io/block/index/IBSkipSpan.java @@ -283,7 +283,8 @@ public class IBSkipSpan extends BSkipSpan { BSkipSpan.loadInit(bss, bf, bsl, np, key, val); bss.loadFirstKey(); Comparable nextFirstKey = bss.firstKey; - if (previousFirstKey.compareTo(nextFirstKey) >= 0) { + if (previousFirstKey == null || nextFirstKey == null || + previousFirstKey.compareTo(nextFirstKey) >= 0) { // TODO remove, but if we are at the bottom of a level // we have to remove the level too, which is a mess BlockFile.log.error("Corrupt database, span out of order " + ((BSkipSpan)bss.prev).page + @@ -312,7 +313,8 @@ public class IBSkipSpan extends BSkipSpan { BSkipSpan.loadInit(bss, bf, bsl, np, key, val); bss.loadFirstKey(); Comparable previousFirstKey = bss.firstKey; - if (previousFirstKey.compareTo(nextFirstKey) >= 0) { + if (previousFirstKey == null || nextFirstKey == null || + previousFirstKey.compareTo(nextFirstKey) >= 0) { // TODO remove, but if we are at the bottom of a level // we have to remove the level too, which is a mess BlockFile.log.error("Corrupt database, span out of order " + bss.page +