From 35a8712eefe9265d1d301b54576597968e6c4ea6 Mon Sep 17 00:00:00 2001 From: Fabrice Lecomte Date: Sat, 27 Feb 2021 01:29:21 +0100 Subject: [PATCH] fix select on query with no result --- src/main/kotlin/fr/postgresjson/connexion/Connection.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/kotlin/fr/postgresjson/connexion/Connection.kt b/src/main/kotlin/fr/postgresjson/connexion/Connection.kt index a486098..a09ec1e 100644 --- a/src/main/kotlin/fr/postgresjson/connexion/Connection.kt +++ b/src/main/kotlin/fr/postgresjson/connexion/Connection.kt @@ -59,7 +59,7 @@ class Connection( it is EntityI && typeReference.type.typeName == it::class.java.name } as R? val result = exec(sql, compileArgs(values)) - val json = result.rows[0].getString(0) + val json = result.rows.firstOrNull()?.getString(0) return if (json === null) { null } else {