From a4e1fa97ea39f89b4c56334b3f0498eb3887be3e Mon Sep 17 00:00:00 2001 From: Phodal Huang Date: Fri, 25 Oct 2024 17:53:06 +0800 Subject: [PATCH] refactor(protobuf): ensure TypeValue is never null with default empty string --- .../main/kotlin/chapi/ast/protobuf/ProtobufFullIdentListener.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/chapi-ast-protobuf/src/main/kotlin/chapi/ast/protobuf/ProtobufFullIdentListener.kt b/chapi-ast-protobuf/src/main/kotlin/chapi/ast/protobuf/ProtobufFullIdentListener.kt index 61e0e0c5..bf1223e6 100644 --- a/chapi-ast-protobuf/src/main/kotlin/chapi/ast/protobuf/ProtobufFullIdentListener.kt +++ b/chapi-ast-protobuf/src/main/kotlin/chapi/ast/protobuf/ProtobufFullIdentListener.kt @@ -112,7 +112,7 @@ class ProtobufFullIdentListener(var fileName: String) : Protobuf3BaseListener() return CodeField( TypeType = child.type_().text, TypeKey = child.fieldName().text, - TypeValue = child.fieldNumber().text, + TypeValue = child.fieldNumber()?.text ?: "", Modifiers = child.fieldLabel()?.text?.let { listOf(it) } ?: emptyList() ) }