diff --git a/compiler/ballerina-lang/src/main/java/org/wso2/ballerinalang/compiler/semantics/analyzer/CodeAnalyzer.java b/compiler/ballerina-lang/src/main/java/org/wso2/ballerinalang/compiler/semantics/analyzer/CodeAnalyzer.java index a3920e3d2720..5f72c9672acf 100644 --- a/compiler/ballerina-lang/src/main/java/org/wso2/ballerinalang/compiler/semantics/analyzer/CodeAnalyzer.java +++ b/compiler/ballerina-lang/src/main/java/org/wso2/ballerinalang/compiler/semantics/analyzer/CodeAnalyzer.java @@ -2804,7 +2804,8 @@ public void visit(BLangTypeInit cIExpr, AnalyzerData data) { analyzeExprs(cIExpr.argsExpr, data); analyzeExpr(cIExpr.initInvocation, data); BType type = cIExpr.getBType(); - if (cIExpr.userDefinedType != null && Symbols.isFlagOn(type.tsymbol.flags, Flags.DEPRECATED)) { + if (cIExpr.userDefinedType != null && type.tsymbol != null && + Symbols.isFlagOn(type.tsymbol.flags, Flags.DEPRECATED)) { logDeprecatedWaring(((BLangUserDefinedType) cIExpr.userDefinedType).typeName.toString(), type.tsymbol, cIExpr.pos); }