Ticket #4735: fix-unchecked-null-returns-in-mythfrontend.patch

File fix-unchecked-null-returns-in-mythfrontend.patch, 1.9 KB (added by Erik Hovland <erik@…>, 16 years ago)

always checks the container pointer before dereferencing

  • programs/mythfrontend/channelrecpriority.cpp

    mythfrontend can call a few functions that return null and then not check that
    
    From: Erik Hovland <erik@hovland.org>
    
    the pointer is null or not. This patch addresses those instances of this defect.
    ---
    
     programs/mythfrontend/channelrecpriority.cpp |    5 ++++-
     programs/mythfrontend/programrecpriority.cpp |    3 +++
     programs/mythfrontend/viewscheduled.cpp      |    3 +++
     3 files changed, 10 insertions(+), 1 deletions(-)
    
    diff --git a/programs/mythfrontend/channelrecpriority.cpp b/programs/mythfrontend/channelrecpriority.cpp
    index 3fbfe61..e56d053 100644
    a b void ChannelRecPriority::updateBackground(void) 
    230230    QPainter tmp(&bground);
    231231
    232232    LayerSet *container = theme->GetSet("background");
    233         container->Draw(&tmp, 0, 0);
     233    if (!container)
     234        return;
     235
     236    container->Draw(&tmp, 0, 0);
    234237
    235238    tmp.end();
    236239    myBackground = bground;
  • programs/mythfrontend/programrecpriority.cpp

    diff --git a/programs/mythfrontend/programrecpriority.cpp b/programs/mythfrontend/programrecpriority.cpp
    index f6c99a2..244fdbd 100644
    a b void ProgramRecPriority::updateBackground(void) 
    391391    QPainter tmp(&bground);
    392392
    393393    LayerSet *container = theme->GetSet("background");
     394    if (!container)
     395        return;
     396
    394397    container->Draw(&tmp, 0, 0);
    395398
    396399    tmp.end();
  • programs/mythfrontend/viewscheduled.cpp

    diff --git a/programs/mythfrontend/viewscheduled.cpp b/programs/mythfrontend/viewscheduled.cpp
    index 9f8c913..9bb7628 100644
    a b void ViewScheduled::updateBackground(void) 
    239239    QPainter tmp(&bground);
    240240
    241241    LayerSet *container = theme->GetSet("background");
     242    if (!container)
     243        return;
     244
    242245    container->Draw(&tmp, 0, 0);
    243246
    244247    tmp.end();