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

Commit 2a1cfc2

Browse files
Fix a cast to a group before checking the control's type
This was causing assertion failures when drag-selecting controls.
1 parent 99464b8 commit 2a1cfc2

1 file changed

Lines changed: 26 additions & 24 deletions

File tree

engine/src/card.cpp

Lines changed: 26 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -2819,35 +2819,37 @@ void MCCard::updateselection(MCControl *cptr, const MCRectangle &oldrect,
28192819
if (!cptr -> isselectable()
28202820
&& (!MCselectgrouped || cptr->gettype() != CT_GROUP))
28212821
return;
2822-
MCGroup *gptr = MCObjectCast<MCGroup>(cptr);
28232822

28242823
// MW-2008-12-04: [[ Bug ]] Make sure we honour group-local selectGrouped for
28252824
// select-tool drags
2826-
if (MCselectgrouped && cptr->gettype() == CT_GROUP
2827-
&& gptr->getcontrols() != NULL && gptr->getflag(F_VISIBLE) && !gptr->getflag(F_SELECT_GROUP))
2825+
if (MCselectgrouped && cptr->gettype() == CT_GROUP)
28282826
{
2829-
cptr = gptr->getcontrols();
2830-
2831-
MCRectangle t_group_rect;
2832-
t_group_rect = gptr -> getrect();
2833-
2834-
MCRectangle t_group_oldrect;
2835-
t_group_oldrect = MCU_intersect_rect(oldrect, t_group_rect);
2836-
2837-
MCRectangle t_group_selrect;
2838-
t_group_selrect = MCU_intersect_rect(selrect, t_group_rect);
2827+
MCGroup *gptr = MCObjectCast<MCGroup>(cptr);
2828+
if (gptr->getcontrols() != NULL && gptr->getflag(F_VISIBLE) && !gptr->getflag(F_SELECT_GROUP))
2829+
{
2830+
cptr = gptr->getcontrols();
28392831

2840-
do
2841-
{
2842-
MCRectangle t_rect;
2843-
t_rect = cptr -> getrect();
2844-
if (MCU_line_intersect_rect(t_group_rect, t_rect))
2845-
updateselection(cptr, t_group_oldrect, t_group_selrect, drect);
2846-
2847-
cptr = cptr->next();
2848-
}
2849-
while (cptr != gptr->getcontrols());
2850-
}
2832+
MCRectangle t_group_rect;
2833+
t_group_rect = gptr -> getrect();
2834+
2835+
MCRectangle t_group_oldrect;
2836+
t_group_oldrect = MCU_intersect_rect(oldrect, t_group_rect);
2837+
2838+
MCRectangle t_group_selrect;
2839+
t_group_selrect = MCU_intersect_rect(selrect, t_group_rect);
2840+
2841+
do
2842+
{
2843+
MCRectangle t_rect;
2844+
t_rect = cptr -> getrect();
2845+
if (MCU_line_intersect_rect(t_group_rect, t_rect))
2846+
updateselection(cptr, t_group_oldrect, t_group_selrect, drect);
2847+
2848+
cptr = cptr->next();
2849+
}
2850+
while (cptr != gptr->getcontrols());
2851+
}
2852+
}
28512853
else
28522854
{
28532855
Boolean was, is;

0 commit comments

Comments
 (0)