Skip to content
Permalink
Browse files

Fixed a NullPointerException case, reported in issue #209

  • Loading branch information...
luccioman committed Aug 6, 2018
1 parent 8a29551 commit 1ca9cb6bd90bd303f8cb2078213f9d12f8ce8c7d
Showing with 8 additions and 6 deletions.
  1. +8 −6 htroot/ConfigHeuristics_p.java
@@ -204,13 +204,15 @@ public static serverObjects respond(@SuppressWarnings("unused") final RequestHea
prop.putHTML("osdcfg_" + c + "_title", e.key());
prop.putHTML("osdcfg_" + c + "_comment", e.getComment() != null ? e.getComment() : "");

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

c++;
}

0 comments on commit 1ca9cb6

Please sign in to comment.
You can’t perform that action at this time.