-
Notifications
You must be signed in to change notification settings - Fork 414
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
NullPointerException potentially "safe area insets can be null" #3764
Comments
Hi did this fix make it to last Friday's update (7.0.128)? I have received another bug report the same as above: - [EDT] 0:55:32,455 - Exception: java.lang.NullPointerException - null java.lang.NullPointerException |
Is this with the current build? Assuming it is then it should be fixed and I'm reopening the issue. |
Yes, I updated the project to version 7.0.128 and then released a new version. That report was from the latest version. |
As stated in the stackoverflow question: - |
Another today: - [EDT] 0:0:15,839 - Exit smsapp - Display.SMS_INTERACTIVE [EDT] 0:0:15,839 - Exit b_gateTrigSMS Action |
I posted another fix. There are two possibilities I can think of:
If this is only happening in iOS 13 or newer then the latter might be the reason in which case we will need to replace UIWindow *window = nil;
if (@available(iOS 13.0, *)) {
for (UIWindow *aWindow in UIApplication.sharedApplication.windows) {
if (aWindow.isKeyWindow) {
window = aWindow;
break;
}
}
} else {
window = UIApplication.sharedApplication.keyWindow;
}
if (window != nil) {
return (JAVA_INT)(window.safeAreaInsets.left * scaleValue);
} |
As requested I have filed an issue with ref to this question.
I have been receiving NullPointerException reports as per below. Often they occur just after the device orientation changes. example report below: -
[EDT] 11:19:53,486 - Orientation changed to Landscape - showHomeForm
[EDT] 11:19:53,490 - line 572
[EDT] 11:19:53,495 - line 574
[EDT] 11:19:53,935 - line 576
[EDT] 11:19:53,940 - Orientation changed to Landscape Finished - showHomeForm
[EDT] 11:19:53,954 - line 565
[EDT] 11:19:53,957 - Orientation changed to Portrait Finished - showHomeForm
[EDT] 11:19:58,803 - Exception: java.lang.NullPointerException - null
java.lang.NullPointerException at
com_codename1_impl_ios_IOSImplementation.getDisplaySafeArea:256
at com_codename1_ui_Container.snapToSafeAreaInternal:2395
at com_codename1_ui_Container.calcPreferredSize:3176
at com_codename1_ui_Component.preferredSizeImpl:3545
at com_codename1_ui_Component.preferredSize:3584
at com_codename1_ui_Component.getPreferredSize:1449
at com_codename1_ui_Component.getPreferredH:1539
at com_codename1_ui_layouts_BorderLayout.positionTopBottom:477
at com_codename1_ui_layouts_BorderLayout.layoutContainer:317
at com_codename1_ui_Container.doLayout:2583
at com_codename1_ui_Container.layoutContainer:2219
at com_codename1_ui_Container.doLayout:2588
at com_codename1_ui_Container.layoutContainer:2219
at com_codename1_ui_Container.doLayout:2588
at com_codename1_ui_Form.sizeChangedInternal:881
at com_codename1_ui_Display.handleEvent:2514
at com_codename1_ui_Display.edtLoopImpl:1300
at com_codename1_ui_Display.mainEDTLoop:1218
at com_codename1_ui_RunnableWrapper.run:120
at com_codename1_impl_CodenameOneThread.run:176
at java_lang_Thread.runImpl:153
[EDT] 11:19:58,823 - Exception in My App version 2.03
[EDT] 11:19:58,827 - OS ios
[EDT] 11:19:58,832 - Error java.lang.NullPointerException
[EDT] 11:19:58,836 - Current Form VXSMS_Main
[EDT] 11:19:58,840 - Exception: java.lang.NullPointerException - null
java.lang.NullPointerException at
com_codename1_impl_ios_IOSImplementation.getDisplaySafeArea:256
at com_codename1_ui_Container.snapToSafeAreaInternal:2395
at com_codename1_ui_Container.calcPreferredSize:3176
at com_codename1_ui_Component.preferredSizeImpl:3545
at com_codename1_ui_Component.preferredSize:3584
at com_codename1_ui_Component.getPreferredSize:1449
at com_codename1_ui_Component.getPreferredH:1539
at com_codename1_ui_layouts_BorderLayout.positionTopBottom:477
at com_codename1_ui_layouts_BorderLayout.layoutContainer:317
at com_codename1_ui_Container.doLayout:2583
at com_codename1_ui_Container.layoutContainer:2219
at com_codename1_ui_Container.doLayout:2588
at com_codename1_ui_Container.layoutContainer:2219
at com_codename1_ui_Container.doLayout:2588
at com_codename1_ui_Form.sizeChangedInternal:881
at com_codename1_ui_Display.handleEvent:2514
at com_codename1_ui_Display.edtLoopImpl:1300
at com_codename1_ui_Display.mainEDTLoop:1218
at com_codename1_ui_RunnableWrapper.run:120
at com_codename1_impl_CodenameOneThread.run:176
at java_lang_Thread.runImpl:153
Additional context
This only occurs with iOS and I have only been able to recreate this issue myself once. It was after a long period of inactivity. After this time, opening the app, the iPhone was displaying a message of low battery. I then rotated the device a few times.
The text was updated successfully, but these errors were encountered: