Skip to content
This repository was archived by the owner on Aug 31, 2021. It is now read-only.

Commit 0a86654

Browse files
committed
[[ Bug 18273 ]] Prevent crash when rendering card with invalid objptr
1 parent 51ca551 commit 0a86654

File tree

2 files changed

+12
-5
lines changed

2 files changed

+12
-5
lines changed

docs/notes/bugfix-18273.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# Prevent crash when rendering card with invalid objptr

engine/src/card.cpp

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3040,11 +3040,15 @@ void MCCard::drawselectedchildren(MCDC *dc)
30403040
return;
30413041
do
30423042
{
3043-
if (tptr -> getref() -> getstate(CS_SELECTED))
3044-
tptr->getref()->drawselected(dc);
3043+
MCControl *t_control = tptr->getref();
3044+
if (t_control != nullptr)
3045+
{
3046+
if (tptr -> getref() -> getstate(CS_SELECTED))
3047+
tptr->getref()->drawselected(dc);
30453048

3046-
if (tptr -> getrefasgroup() != nil)
3047-
tptr -> getrefasgroup() -> drawselectedchildren(dc);
3049+
if (tptr -> getrefasgroup() != nil)
3050+
tptr -> getrefasgroup() -> drawselectedchildren(dc);
3051+
}
30483052

30493053
tptr = tptr->next();
30503054
}
@@ -3115,7 +3119,9 @@ void MCCard::draw(MCDC *dc, const MCRectangle& dirty, bool p_isolated)
31153119
MCObjptr *tptr = objptrs;
31163120
do
31173121
{
3118-
tptr->getref()->redraw(dc, dirty);
3122+
MCControl *t_control = tptr->getref();
3123+
if (t_control != nullptr)
3124+
t_control->redraw(dc, dirty);
31193125
tptr = tptr->next();
31203126
}
31213127
while (tptr != objptrs);

0 commit comments

Comments
 (0)