Skip to content

Commit 693b3bf

Browse files
authored
Add null check for button before playing sound
1 parent 82b8706 commit 693b3bf

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/main.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -704,13 +704,13 @@ class $modify(MyEditorUI, EditorUI) {
704704

705705
void onGroupSticky(CCObject* sender) {
706706
auto btn = static_cast<CCMenuItemSpriteExtra*>(sender);
707-
if (btn->m_animationEnabled) SoundHandler::get().playSound("link");
707+
if (btn && btn->m_animationEnabled) SoundHandler::get().playSound("link");
708708
EditorUI::onGroupSticky(sender);
709709
}
710710

711711
void onUngroupSticky(CCObject* sender) {
712712
auto btn = static_cast<CCMenuItemSpriteExtra*>(sender);
713-
if (btn->m_animationEnabled) SoundHandler::get().playSound("unlink");
713+
if (btn && btn->m_animationEnabled) SoundHandler::get().playSound("unlink");
714714
EditorUI::onUngroupSticky(sender);
715715
}
716716

@@ -835,4 +835,4 @@ class $modify(MyEditButtonBar, EditButtonBar) {
835835
}
836836
});
837837
};
838-
};
838+
};

0 commit comments

Comments
 (0)