mirror of
https://github.com/aseprite/aseprite.git
synced 2025-01-05 21:57:20 +00:00
Add some checks in move_focus() for null pointers in gui/manager.cpp.
This commit is contained in:
parent
5380877c4a
commit
4a4db10ea8
@ -1453,21 +1453,24 @@ static bool move_focus(JWidget manager, Message* msg)
|
|||||||
Widget* focus = NULL;
|
Widget* focus = NULL;
|
||||||
Widget* it;
|
Widget* it;
|
||||||
bool ret = false;
|
bool ret = false;
|
||||||
Frame* window;
|
Frame* window = NULL;
|
||||||
int c, count;
|
int c, count;
|
||||||
|
|
||||||
/* who have the focus */
|
// Who have the focus
|
||||||
if (focus_widget)
|
if (focus_widget) {
|
||||||
window = static_cast<Frame*>(focus_widget->getRoot());
|
window = dynamic_cast<Frame*>(focus_widget->getRoot());
|
||||||
else if (!jlist_empty(manager->children))
|
}
|
||||||
|
else if (!jlist_empty(manager->children)) {
|
||||||
window = TOPWND(manager);
|
window = TOPWND(manager);
|
||||||
else
|
}
|
||||||
return ret;
|
|
||||||
|
|
||||||
/* how many child-widget want the focus in this widget? */
|
if (!window)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
// How many child-widget want the focus in this widget?
|
||||||
count = count_widgets_accept_focus(window);
|
count = count_widgets_accept_focus(window);
|
||||||
|
|
||||||
/* one at least */
|
// One at least
|
||||||
if (count > 0) {
|
if (count > 0) {
|
||||||
std::vector<Widget*> list(count);
|
std::vector<Widget*> list(count);
|
||||||
|
|
||||||
@ -1553,6 +1556,8 @@ static bool move_focus(JWidget manager, Message* msg)
|
|||||||
|
|
||||||
static int count_widgets_accept_focus(JWidget widget)
|
static int count_widgets_accept_focus(JWidget widget)
|
||||||
{
|
{
|
||||||
|
ASSERT(widget != NULL);
|
||||||
|
|
||||||
int count = 0;
|
int count = 0;
|
||||||
JLink link;
|
JLink link;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user