]> git.openstreetmap.org Git - rails.git/blobdiff - vendor/plugins/sql_session_store/lib/postgresql_session.rb
fix typo which meant that it was testing the node twice, rather than the node then...
[rails.git] / vendor / plugins / sql_session_store / lib / postgresql_session.rb
index 60046833a2bf2e657be83f1e17b5121596b970b8..53dc04c73cee359363e029c44415a913a6b8de2d 100755 (executable)
@@ -46,8 +46,12 @@ class PostgresqlSession
     def find_session(session_id)
       connection = session_connection
       result = connection.query("SELECT id, data FROM sessions WHERE session_id = $1 LIMIT 1", [session_id])
-      my_session = new(session_id, result.getvalue(0, 1))
-      my_session.id = result.getvalue(0, 0)
+      if result.ntuples > 0
+        my_session = new(session_id, result.getvalue(0, 1))
+        my_session.id = result.getvalue(0, 0)
+      else
+        my_session = nil
+      end
       result.clear
       my_session
     end