Ticket #5090: libs_libmythfreemheg_TokenGroup.cpp-check-for-null.patch

File libs_libmythfreemheg_TokenGroup.cpp-check-for-null.patch, 1.2 KB (added by Erik Hovland <erik@…>, 12 years ago)

check position pointer for null

  • libs/libmythfreemheg/TokenGroup.cpp

    
    From: Erik Hovland <erik@hovland.org>
    
    
    ---
    
     libs/libmythfreemheg/TokenGroup.cpp |   10 ++++++----
     1 files changed, 6 insertions(+), 4 deletions(-)
    
    diff --git a/libs/libmythfreemheg/TokenGroup.cpp b/libs/libmythfreemheg/TokenGroup.cpp
    index 6e537ef..88db2eb 100644
    a b void MHListGroup::Initialise(MHParseNode *p, MHEngine *engine) 
    227227{
    228228    MHTokenGroup::Initialise(p, engine);
    229229    MHParseNode *pPositions = p->GetNamedArg(C_POSITIONS);
    230     for (int i = 0; i < pPositions->GetArgCount(); i++) {
    231         MHParseNode *pPos = pPositions->GetArgN(i);
    232         QPoint pos(pPos->GetSeqN(0)->GetIntValue(), pPos->GetSeqN(1)->GetIntValue());
    233         m_Positions.Append(pos);
     230    if (pPositions) {
     231        for (int i = 0; i < pPositions->GetArgCount(); i++) {
     232            MHParseNode *pPos = pPositions->GetArgN(i);
     233            QPoint pos(pPos->GetSeqN(0)->GetIntValue(), pPos->GetSeqN(1)->GetIntValue());
     234            m_Positions.Append(pos);
     235        }
    234236    }
    235237    MHParseNode *pWrap = p->GetNamedArg(C_WRAP_AROUND);
    236238    if (pWrap) m_fWrapAround = pWrap->GetArgN(0)->GetBoolValue();