Skip to content

Commit

Permalink
21437: Fixes crash when specifying invalid label to get_entity_commen…
Browse files Browse the repository at this point in the history
…ts (#247)
  • Loading branch information
howsohazard authored Aug 30, 2024
1 parent 73930f9 commit 32998db
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/Amalgam/interpreter/InterpreterOpcodesEntityControl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,13 +67,15 @@ EvaluableNodeReference Interpreter::InterpretNode_ENT_GET_ENTITY_COMMENTS(Evalua
}

auto label_value = target_entity->GetValueAtLabel(label_sid, nullptr, true);
if(label_value == nullptr)
return EvaluableNodeReference::Null();

//has valid label
if(!deep_comments)
return AllocReturn(label_value->GetCommentsStringId(), immediate_result);

//make sure a function based on declare that has parameters
if(label_value == nullptr || label_value->GetType() != ENT_DECLARE || label_value->GetOrderedChildNodes().size() < 1)
if(label_value->GetType() != ENT_DECLARE || label_value->GetOrderedChildNodes().size() < 1)
return EvaluableNodeReference::Null();

//the first element is an assoc of the parameters, the second element is the return value
Expand Down

0 comments on commit 32998db

Please sign in to comment.