From 65c787e476efa5381e3b5b57b1c6da4b8b859658 Mon Sep 17 00:00:00 2001 From: Aneesh Makala Date: Fri, 27 Dec 2024 17:40:56 +0530 Subject: [PATCH] check type assertion --- yb-voyager/src/query/queryparser/helpers_protomsg.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/yb-voyager/src/query/queryparser/helpers_protomsg.go b/yb-voyager/src/query/queryparser/helpers_protomsg.go index 4713a9251..de3204f3c 100644 --- a/yb-voyager/src/query/queryparser/helpers_protomsg.go +++ b/yb-voyager/src/query/queryparser/helpers_protomsg.go @@ -409,7 +409,10 @@ func GetSchemaAndObjectName(nameList protoreflect.List) (string, string) { } func ProtoAsSelectStmt(msg protoreflect.Message) (*pg_query.SelectStmt, error) { - protoMsg := msg.Interface().(proto.Message) + protoMsg, ok := msg.Interface().(proto.Message) + if !ok { + return nil, fmt.Errorf("failed to cast msg to proto.Message") + } selectStmtNode, ok := protoMsg.(*pg_query.SelectStmt) if !ok { return nil, fmt.Errorf("failed to cast msg to %s", PG_QUERY_SELECTSTMT_NODE)