X-Git-Url: https://git.openstreetmap.org./rails.git/blobdiff_plain/42359afa7ef2b6c95fe4051dd28b6187e5d4aef6..6327e3e690aea05aaad047d93f19f9297ac9c213:/vendor/plugins/sql_session_store/lib/postgresql_session.rb diff --git a/vendor/plugins/sql_session_store/lib/postgresql_session.rb b/vendor/plugins/sql_session_store/lib/postgresql_session.rb index 60046833a..53dc04c73 100755 --- a/vendor/plugins/sql_session_store/lib/postgresql_session.rb +++ b/vendor/plugins/sql_session_store/lib/postgresql_session.rb @@ -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