[fix](multi-catalog)switching catalogs after dropping will get NPE. (#16067)
Issue Number: close #16066
This commit is contained in:
@ -4357,7 +4357,10 @@ public class Env {
|
||||
|
||||
String currentDB = ctx.getDatabase();
|
||||
if (StringUtils.isNotEmpty(currentDB)) {
|
||||
catalogMgr.addLastDBOfCatalog(ctx.getCurrentCatalog().getName(), currentDB);
|
||||
// When dropped the current catalog in current context, the current catalog will be null.
|
||||
if (ctx.getCurrentCatalog() != null) {
|
||||
catalogMgr.addLastDBOfCatalog(ctx.getCurrentCatalog().getName(), currentDB);
|
||||
}
|
||||
}
|
||||
ctx.changeDefaultCatalog(catalogName);
|
||||
String lastDb = catalogMgr.getLastDB(catalogName);
|
||||
|
||||
Reference in New Issue
Block a user