Ticket #5147: programs_mythfrontend-make-sure-check-for-null-is-done-ticket-5147.2.patch

File programs_mythfrontend-make-sure-check-for-null-is-done-ticket-5147.2.patch, 3.1 KB (added by Erik Hovland <erik@…>, 12 years ago)

This patch adds one more null check. Forgotten in the attachment a few minutes ago

  • programs/mythfrontend/playbackbox.cpp

    Making sure that list is valid before dereferencing it. Forgetting to can
    
    From: Erik Hovland <erik@hovland.org>
    
    mean a segfault for mythfrontend
    ---
    
     programs/mythfrontend/playbackbox.cpp        |   36 +++++++-------------------
     programs/mythfrontend/programrecpriority.cpp |   12 ++++-----
     2 files changed, 15 insertions(+), 33 deletions(-)
    
    diff --git a/programs/mythfrontend/playbackbox.cpp b/programs/mythfrontend/playbackbox.cpp
    index 4976f4f..26c6ca8 100644
    a b void PlaybackBox::updateBackground(void) 
    679679    QPainter tmp(&bground);
    680680
    681681    LayerSet *container = theme->GetSet("background");
    682     if (container && type != Delete)
    683         container->Draw(&tmp, 0, 0);
    684     else
    685         container->Draw(&tmp, 0, 1);
     682    if (container)
     683        container->Draw(&tmp, 0, type == Delete);
    686684
    687685    tmp.end();
    688686    paintBackgroundPixmap = bground;
    void PlaybackBox::updateVideo(QPainter *p) 
    10361034        QPixmap pix(drawVideoBounds.size());
    10371035        pix.fill(this, drawVideoBounds.topLeft());
    10381036        QPainter tmp(&pix);
    1039         container->Draw(&tmp, 1, 1);
     1037        if (container)
     1038            container->Draw(&tmp, 1, 1);
     1039
    10401040        tmp.end();
    10411041        p->drawPixmap(drawVideoBounds.topLeft(), pix);
    10421042    }
    void PlaybackBox::updateShowTitles(QPainter *p) 
    15381538        lcddev->switchToMenu(&lcdItems, lcdTitle);
    15391539
    15401540    // DRAW LAYERS
    1541     if (container && type != Delete)
    1542     {
    1543         container->Draw(&tmp, 0, 0);
    1544         container->Draw(&tmp, 1, 0);
    1545         container->Draw(&tmp, 2, 0);
    1546         container->Draw(&tmp, 3, 0);
    1547         container->Draw(&tmp, 4, 0);
    1548         container->Draw(&tmp, 5, 0);
    1549         container->Draw(&tmp, 6, 0);
    1550         container->Draw(&tmp, 7, 0);
    1551         container->Draw(&tmp, 8, 0);
    1552     }
    1553     else
     1541    if (container)
    15541542    {
    1555         container->Draw(&tmp, 0, 1);
    1556         container->Draw(&tmp, 1, 1);
    1557         container->Draw(&tmp, 2, 1);
    1558         container->Draw(&tmp, 3, 1);
    1559         container->Draw(&tmp, 4, 1);
    1560         container->Draw(&tmp, 5, 1);
    1561         container->Draw(&tmp, 6, 1);
    1562         container->Draw(&tmp, 7, 1);
    1563         container->Draw(&tmp, 8, 1);
     1543        bool typeIsEqToDel = type == Delete;
     1544        for (int i = 0; i < 9; i++)
     1545            container->Draw(&tmp, i, typeIsEqToDel);
    15641546    }
    15651547
    15661548    leftRight = false;
  • programs/mythfrontend/programrecpriority.cpp

    diff --git a/programs/mythfrontend/programrecpriority.cpp b/programs/mythfrontend/programrecpriority.cpp
    index 38c2c15..f92ee0f 100644
    a b void ProgramRecPriority::updateList(QPainter *p) 
    14301430                else
    14311431                    pageDowner = true;
    14321432            }
    1433         }
    14341433
    1435         ltype->SetDownArrow(pageDowner);
    1436         if (inData > 0)
    1437             ltype->SetUpArrow(true);
    1438         else
    1439             ltype->SetUpArrow(false);
     1434            ltype->SetDownArrow(pageDowner);
     1435            if (inData > 0)
     1436                ltype->SetUpArrow(true);
     1437            else
     1438                ltype->SetUpArrow(false);
     1439        }
    14401440    }
    14411441
    14421442    if (programData.count() <= 0)