Skip to content

Commit 5f058e3

Browse files
Merge pull request livecode#6686 from livecodepanos/bugfix-21582
[21582] Fix crash when saving a stack that has a colorswatch widget
2 parents 46d93f2 + 833a0be commit 5f058e3

2 files changed

Lines changed: 6 additions & 0 deletions

File tree

docs/notes/bugfix-21582.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# Fix crash and stack corruption when opening a stack that has a colorswatch widget

engine/src/widget.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -810,7 +810,12 @@ IO_stat MCWidget::save(IO_handle p_stream, uint4 p_part, bool p_force_ext, uint3
810810
// Make the widget generate a rep.
811811
MCAutoValueRef t_rep;
812812
if (m_widget != nil)
813+
{
813814
MCWidgetOnSave(m_widget, &t_rep);
815+
// A widget might not have an OnSave handler (e.g. colorswatch widget)
816+
if (*t_rep == nil)
817+
t_rep = kMCNull;
818+
}
814819
else if (m_rep != nil)
815820
t_rep = m_rep;
816821
else

0 commit comments

Comments
 (0)