Skip to content

Commit

Permalink
check type assertion
Browse files Browse the repository at this point in the history
  • Loading branch information
makalaaneesh committed Dec 27, 2024
1 parent 69c7a4c commit 65c787e
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion yb-voyager/src/query/queryparser/helpers_protomsg.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 65c787e

Please sign in to comment.