diff --git a/jOOQ-codegen/src/main/java/org/jooq/codegen/GenerationTool.java b/jOOQ-codegen/src/main/java/org/jooq/codegen/GenerationTool.java index 14223323ef..c5b661b415 100644 --- a/jOOQ-codegen/src/main/java/org/jooq/codegen/GenerationTool.java +++ b/jOOQ-codegen/src/main/java/org/jooq/codegen/GenerationTool.java @@ -903,7 +903,9 @@ public class GenerationTool { // Close connection only if it was created by the GenerationTool if (connection != null) { if (close) { - if (ctx.family() == HSQLDB && dataSource == null) + + // [#11105] In case of misconfiguration, the ctx reference could be null as a side effect + if (ctx != null && ctx.family() == HSQLDB && dataSource == null) ctx.execute("shutdown"); connection.close();