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) |
679 | 679 | QPainter tmp(&bground); |
680 | 680 | |
681 | 681 | 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); |
686 | 684 | |
687 | 685 | tmp.end(); |
688 | 686 | paintBackgroundPixmap = bground; |
… |
… |
void PlaybackBox::updateVideo(QPainter *p) |
1036 | 1034 | QPixmap pix(drawVideoBounds.size()); |
1037 | 1035 | pix.fill(this, drawVideoBounds.topLeft()); |
1038 | 1036 | QPainter tmp(&pix); |
1039 | | container->Draw(&tmp, 1, 1); |
| 1037 | if (container) |
| 1038 | container->Draw(&tmp, 1, 1); |
| 1039 | |
1040 | 1040 | tmp.end(); |
1041 | 1041 | p->drawPixmap(drawVideoBounds.topLeft(), pix); |
1042 | 1042 | } |
… |
… |
void PlaybackBox::updateShowTitles(QPainter *p) |
1538 | 1538 | lcddev->switchToMenu(&lcdItems, lcdTitle); |
1539 | 1539 | |
1540 | 1540 | // 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) |
1554 | 1542 | { |
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); |
1564 | 1546 | } |
1565 | 1547 | |
1566 | 1548 | leftRight = false; |
diff --git a/programs/mythfrontend/programrecpriority.cpp b/programs/mythfrontend/programrecpriority.cpp
index 38c2c15..f92ee0f 100644
a
|
b
|
void ProgramRecPriority::updateList(QPainter *p) |
1430 | 1430 | else |
1431 | 1431 | pageDowner = true; |
1432 | 1432 | } |
1433 | | } |
1434 | 1433 | |
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 | } |
1440 | 1440 | } |
1441 | 1441 | |
1442 | 1442 | if (programData.count() <= 0) |