]> granicus.if.org Git - postgis/commitdiff
Fix possible null pointer exception if PostGIS is compiled without geos / proj support.
authorMarkus Schaber <markus@schabi.de>
Tue, 8 Mar 2005 18:32:35 +0000 (18:32 +0000)
committerMarkus Schaber <markus@schabi.de>
Tue, 8 Mar 2005 18:32:35 +0000 (18:32 +0000)
git-svn-id: http://svn.osgeo.org/postgis/trunk@1524 b70326c6-7e19-0410-871a-916f4a2858ee

jdbc2/src/examples/VersionPrinter.java

index 4f43cd1488f559abd7320d3532f98f8f1caaf84d..7cdd4197669b25596032ab58573f0ab46c9b4a28 100644 (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 -- ";
         }