Fixed a NullPointerException case, reported in issue #209

pull/218/head
luccioman 7 years ago
parent 8a29551c54
commit 1ca9cb6bd9

@ -204,13 +204,15 @@ public class ConfigHeuristics_p {
prop.putHTML("osdcfg_" + c + "_title", e.key()); prop.putHTML("osdcfg_" + c + "_title", e.key());
prop.putHTML("osdcfg_" + c + "_comment", e.getComment() != null ? e.getComment() : ""); prop.putHTML("osdcfg_" + c + "_comment", e.getComment() != null ? e.getComment() : "");
String tmps = e.getValue(); String urlStr = e.getValue();
prop.putHTML("osdcfg_" + c + "_url", tmps); prop.putHTML("osdcfg_" + c + "_url", urlStr);
final int lastpos = tmps.lastIndexOf("/"); final int lastpos = urlStr != null ? urlStr.lastIndexOf("/") : -1;
if (lastpos > 6) { // after http://x or ftp://x if (lastpos > 6) { // after http://x or ftp://x
tmps = tmps.substring(0, lastpos); urlStr = urlStr.substring(0, lastpos);
prop.putHTML("osdcfg_" + c + "_urlhostlink", tmps); prop.putHTML("osdcfg_" + c + "_urlhostlink", urlStr);
} else prop.putHTML("osdcfg_" + c + "_urlhostlink", "#"); } else {
prop.putHTML("osdcfg_" + c + "_urlhostlink", "#");
}
c++; c++;
} }

Loading…
Cancel
Save