Skip to content

Distributed Peer-to-Peer Web Search Engine and Intranet Search Appliance

fix for npe

orbiter279482a76db9
diff --git a/htroot/index.java b/htroot/index.java
index 92141e3f4..ed436c9d1 100644
--- a/htroot/index.java
+++ b/htroot/index.java
@@ -102,7 +102,7 @@ public class index {
prop.put("searchoptions_count-10", (count == 10) ? "1" : "0");
prop.put("searchoptions_count-50", (count == 50) ? "1" : "0");
prop.put("searchoptions_count-100", (count == 100) ? "1" : "0");
- prop.put("searchoptions_resource-select", sb.peers.sizeConnected() > 0 ? 1 : 0);
+ prop.put("searchoptions_resource-select", (sb.peers == null) ? 0 : sb.peers.sizeConnected() > 0 ? 1 : 0);
prop.put("searchoptions_resource-select_global", global ? "1" : "0");
prop.put("searchoptions_resource-select_global-disabled", (indexReceiveGranted && indexDistributeGranted) ? "0" : "1");
prop.put("searchoptions_resource-select_global-disabled_reason", (indexReceiveGranted) ? "0" : (indexDistributeGranted ? "1" : "2"));
diff --git a/source/net/yacy/peers/NewsQueue.java b/source/net/yacy/peers/NewsQueue.java
index 328c856ba..189fd919f 100644
--- a/source/net/yacy/peers/NewsQueue.java
+++ b/source/net/yacy/peers/NewsQueue.java
@@ -59,8 +59,7 @@ import net.yacy.kelondro.order.NaturalOrder;
import net.yacy.kelondro.table.Table;
import net.yacy.kelondro.util.FileUtils;
-
-public class NewsQueue {
+public class NewsQueue implements Iterable<NewsDB.Record> {
private final File path;
private Table queueStack;
@@ -173,6 +172,11 @@ public class NewsQueue {
return b;
}
+ @Override
+ public Iterator<NewsDB.Record> iterator() {
+ return records(true);
+ }
+
public Iterator<NewsDB.Record> records(final boolean up) {
// iterates yacyNewsRecord-type objects
if (this.queueStack == null) return new HashSet<NewsDB.Record>().iterator();