Browse Source

Added extra nullptr checks in Android windowing code which fixes rare crashes when callbacks occur before the Component peer has been fully constructed

tags/2021-05-28
hogliux 8 years ago
parent
commit
f8ae98894f
1 changed files with 6 additions and 2 deletions
  1. +6
    -2
      modules/juce_gui_basics/native/juce_android_Windowing.cpp

+ 6
- 2
modules/juce_gui_basics/native/juce_android_Windowing.cpp View File

@@ -438,12 +438,16 @@ public:
//============================================================================== //==============================================================================
bool isFocused() const override bool isFocused() const override
{ {
return view.callBooleanMethod (ComponentPeerView.hasFocus);
if (view != nullptr)
return view.callBooleanMethod (ComponentPeerView.hasFocus);
return false;
} }
void grabFocus() override void grabFocus() override
{ {
view.callBooleanMethod (ComponentPeerView.requestFocus);
if (view != nullptr)
view.callBooleanMethod (ComponentPeerView.requestFocus);
} }
void handleFocusChangeCallback (bool hasFocus) void handleFocusChangeCallback (bool hasFocus)


Loading…
Cancel
Save