Use default values if values can not be parsed.
authorDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Tue, 9 Oct 2012 18:03:56 +0000 (20:03 +0200)
committerDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Tue, 9 Oct 2012 18:04:00 +0000 (20:04 +0200)
Thanks to digger3 for spotting this one.

src/main/java/net/pterodactylus/sone/freenet/wot/WebOfTrustConnector.java

index 53a45b1..c4e8d89 100644 (file)
@@ -144,8 +144,8 @@ public class WebOfTrustConnector {
                        identity.setContexts(parseContexts("Contexts" + identityCounter + ".", fields));
                        identity.setProperties(parseProperties("Properties" + identityCounter + ".", fields));
                        Integer trust = Numbers.safeParseInteger(fields.get("Trust" + identityCounter), null);
-                       int score = Numbers.safeParseInteger(fields.get("Score" + identityCounter));
-                       int rank = Numbers.safeParseInteger(fields.get("Rank" + identityCounter));
+                       int score = Numbers.safeParseInteger(fields.get("Score" + identityCounter), 0);
+                       int rank = Numbers.safeParseInteger(fields.get("Rank" + identityCounter), 0);
                        identity.setTrust(ownIdentity, new Trust(trust, score, rank));
                        identities.add(identity);
                }