Skip to content

Commit

Permalink
Avoid NPE in MySQLErrPacket
Browse files Browse the repository at this point in the history
  • Loading branch information
zhaohehuhu committed Apr 11, 2024
1 parent e02be17 commit 40ad5e0
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,8 @@ object MySQLErrPacket {
case kse: KyuubiSQLException if kse.getCause != null =>
// prefer brief nested error message instead of whole stacktrace
apply(kse.getCause)
case e: Exception if e.getMessage contains "NoSuchDatabaseException" =>
case e: Exception
if (e.getMessage != null) && (e.getMessage contains "NoSuchDatabaseException") =>
MySQLErrPacket(1, MySQLErrorCode.ER_BAD_DB_ERROR, cause.getMessage)
case se: SQLException if se.getSQLState == null =>
MySQLErrPacket(1, MySQLErrorCode.ER_INTERNAL_ERROR, cause.getMessage)
Expand Down

0 comments on commit 40ad5e0

Please sign in to comment.