From 230f4b988cabd3485e9440af8a05c5bb664efeb4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=98yvind=20Raddum=20Berg?= Date: Fri, 1 Sep 2023 14:25:22 +0200 Subject: [PATCH] Guard against NPE with broken SQL files --- .../scala/typo/internal/sqlfiles/readSqlFileDirectories.scala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/typo/src/scala/typo/internal/sqlfiles/readSqlFileDirectories.scala b/typo/src/scala/typo/internal/sqlfiles/readSqlFileDirectories.scala index bc86fa5a00..cf74c9f333 100644 --- a/typo/src/scala/typo/internal/sqlfiles/readSqlFileDirectories.scala +++ b/typo/src/scala/typo/internal/sqlfiles/readSqlFileDirectories.scala @@ -51,7 +51,7 @@ object readSqlFileDirectories { def queryTypeFor(decomposedSql: DecomposedSql, c: Connection): SqlCommandType = { val pc = c.unwrap(classOf[PgConnection]) val q = pc.createQuery(decomposedSql.sqlWithNulls, true, false) - q.query.getSqlCommand.getType + Option(q.query.getSqlCommand).map(_.getType).getOrElse(SqlCommandType.BLANK) } def findSqlFilesUnder(scriptsPath: Path): List[Path] = {