Ticket #5087: libs_libmythfreemheg_Groups.cpp-check-for-null.patch

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

check for null before dereferencing

  • libs/libmythfreemheg/Groups.cpp

    
    From: Erik Hovland <erik@hovland.org>
    
    
    ---
    
     libs/libmythfreemheg/Groups.cpp |    8 +++++---
     1 files changed, 5 insertions(+), 3 deletions(-)
    
    diff --git a/libs/libmythfreemheg/Groups.cpp b/libs/libmythfreemheg/Groups.cpp
    index c50c72b..bd861f0 100644
    a b void MHScene::Initialise(MHParseNode *p, MHEngine *engine) 
    391391    MHGroup::Initialise(p, engine);
    392392    // Event register.
    393393    MHParseNode *pInputEventReg = p->GetNamedArg(C_INPUT_EVENT_REGISTER);
    394     m_nEventReg = pInputEventReg->GetArgN(0)->GetIntValue();
     394    if (pInputEventReg) m_nEventReg = pInputEventReg->GetArgN(0)->GetIntValue();
    395395    // Co-ordinate system
    396396    MHParseNode *pSceneCoords = p->GetNamedArg(C_SCENE_COORDINATE_SYSTEM);
    397     m_nSceneCoordX = pSceneCoords->GetArgN(0)->GetIntValue();
    398     m_nSceneCoordY = pSceneCoords->GetArgN(1)->GetIntValue();
     397    if (pSceneCoords) {
     398        m_nSceneCoordX = pSceneCoords->GetArgN(0)->GetIntValue();
     399        m_nSceneCoordY = pSceneCoords->GetArgN(1)->GetIntValue();
     400    }
    399401    // Aspect ratio
    400402    MHParseNode *pAspectRatio = p->GetNamedArg(C_ASPECT_RATIO);
    401403    if (pAspectRatio) {