diff --git a/Ports/iOSPort/src/com/codename1/impl/ios/IOSImplementation.java b/Ports/iOSPort/src/com/codename1/impl/ios/IOSImplementation.java index 010140ed18..e9e504a9af 100644 --- a/Ports/iOSPort/src/com/codename1/impl/ios/IOSImplementation.java +++ b/Ports/iOSPort/src/com/codename1/impl/ios/IOSImplementation.java @@ -253,11 +253,15 @@ public Rectangle getDisplaySafeArea(Rectangle rect) { if (rect == null) { rect = new Rectangle(); } - int x = nativeInstance.getDisplaySafeInsetLeft(); - int y = nativeInstance.getDisplaySafeInsetTop(); - int w = getDisplayWidth() - nativeInstance.getDisplaySafeInsetRight() - x; - int h = getDisplayHeight() - nativeInstance.getDisplaySafeInsetBottom() - y; - rect.setBounds(x, y, w, h); + try { + int x = nativeInstance.getDisplaySafeInsetLeft(); + int y = nativeInstance.getDisplaySafeInsetTop(); + int w = getDisplayWidth() - nativeInstance.getDisplaySafeInsetRight() - x; + int h = getDisplayHeight() - nativeInstance.getDisplaySafeInsetBottom() - y; + rect.setBounds(x, y, w, h); + } catch (NullPointerException err) { + Log.p("Invalid bounds in getDisplaySafeArea, if this message repeats frequently please let us know..."); + } return rect; }