Fix possible null pointer exception if PostGIS is compiled without geos / proj support.

git-svn-id: http://svn.osgeo.org/postgis/trunk@1524 b70326c6-7e19-0410-871a-916f4a2858ee
This commit is contained in:
Markus Schaber 2005-03-08 18:32:35 +00:00
parent c2853d9b69
commit b467752be5

View file

@ -124,8 +124,14 @@ public class VersionPrinter {
public static String getVersionString(String function, Statement stat) {
try {
ResultSet rs = stat.executeQuery("SELECT " + function + "()");
rs.next();
return rs.getString(1).trim();
if (rs.next()==false) {
return "-- no result --";
}
String version = rs.getString(1);
if (version==null) {
return "-- null result --";
}
return version.trim();
} catch (SQLException e) {
return "-- unavailable -- ";
}