dyanmic_cast can return zero. It should be checked and reported.
From: Erik Hovland <erik@hovland.org>
---
programs/mythfrontend/mythappearance.cpp | 7 ++++++-
1 files changed, 6 insertions(+), 1 deletions(-)
diff --git a/programs/mythfrontend/mythappearance.cpp b/programs/mythfrontend/mythappearance.cpp
index a525723..c3322e7 100644
a
|
b
|
bool MythAppearance::Create() |
64 | 64 | |
65 | 65 | m_topleftarrow = dynamic_cast<MythUIImage *> (GetChild("topleft")); |
66 | 66 | m_bottomrightarrow = dynamic_cast<MythUIImage *> (GetChild("bottomright")); |
67 | | |
68 | 67 | m_size = dynamic_cast<MythUIText *> (GetChild("size")); |
69 | 68 | m_offsets = dynamic_cast<MythUIText *> (GetChild("offsets")); |
70 | 69 | m_changeamount = dynamic_cast<MythUIText *> (GetChild("changeamount")); |
71 | 70 | m_offsets = dynamic_cast<MythUIText *> (GetChild("offsets")); |
72 | 71 | m_changeamount = dynamic_cast<MythUIText *> (GetChild("changeamount")); |
| 72 | if (!m_topleftarrow || !m_bottomrightarrow || !m_size || !m_offsets || |
| 73 | !m_changeamount || !m_offsets || !m_changeamount) |
| 74 | { |
| 75 | VERBOSE(VB_IMPORTANT, "Unable to dynamically cast a child"); |
| 76 | return false; |
| 77 | } |
73 | 78 | |
74 | 79 | m_arrowsize_x = m_topleftarrow->GetArea().width(); |
75 | 80 | m_arrowsize_y = m_topleftarrow->GetArea().height(); |