I2P Address: [http://git.idk.i2p]

Skip to content
Snippets Groups Projects
Commit 546b6685 authored by zzz's avatar zzz
Browse files

fix NPE after corruption ticket #515

parent f6d2ac7f
No related branches found
No related tags found
No related merge requests found
...@@ -283,7 +283,8 @@ public class IBSkipSpan extends BSkipSpan { ...@@ -283,7 +283,8 @@ public class IBSkipSpan extends BSkipSpan {
BSkipSpan.loadInit(bss, bf, bsl, np, key, val); BSkipSpan.loadInit(bss, bf, bsl, np, key, val);
bss.loadFirstKey(); bss.loadFirstKey();
Comparable nextFirstKey = bss.firstKey; 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 // TODO remove, but if we are at the bottom of a level
// we have to remove the level too, which is a mess // we have to remove the level too, which is a mess
BlockFile.log.error("Corrupt database, span out of order " + ((BSkipSpan)bss.prev).page + BlockFile.log.error("Corrupt database, span out of order " + ((BSkipSpan)bss.prev).page +
...@@ -312,7 +313,8 @@ public class IBSkipSpan extends BSkipSpan { ...@@ -312,7 +313,8 @@ public class IBSkipSpan extends BSkipSpan {
BSkipSpan.loadInit(bss, bf, bsl, np, key, val); BSkipSpan.loadInit(bss, bf, bsl, np, key, val);
bss.loadFirstKey(); bss.loadFirstKey();
Comparable previousFirstKey = bss.firstKey; 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 // TODO remove, but if we are at the bottom of a level
// we have to remove the level too, which is a mess // we have to remove the level too, which is a mess
BlockFile.log.error("Corrupt database, span out of order " + bss.page + BlockFile.log.error("Corrupt database, span out of order " + bss.page +
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment