fix NPE after corruption ticket #515

This commit is contained in:
zzz
2011-08-24 18:03:56 +00:00
parent f6d2ac7fb2
commit 546b668502

View File

@ -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 +