Skip to content

Commit 7d01481

Browse files
Denisvaadin-bot
authored andcommitted
fix: avoid NPE in WebBrowser methods (#10524)
fixes #9111
1 parent 3fc5f1f commit 7d01481

1 file changed

Lines changed: 12 additions & 4 deletions

File tree

flow-server/src/main/java/com/vaadin/flow/server/WebBrowser.java

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,13 +43,15 @@ public class WebBrowser implements Serializable {
4343
private BrowserDetails browserDetails = null;
4444

4545
/**
46-
* For internal use only. Configures all properties for the initial empty state.
46+
* For internal use only. Configures all properties for the initial empty
47+
* state.
4748
*/
48-
protected WebBrowser() {}
49+
protected WebBrowser() {
50+
}
4951

5052
/**
51-
* For internal use only. Configures all properties in the class according to
52-
* the given information.
53+
* For internal use only. Configures all properties in the class according
54+
* to the given information.
5355
*
5456
* @param request
5557
* the Vaadin request to read the information from
@@ -301,6 +303,9 @@ public boolean isAndroid() {
301303
*/
302304
@Deprecated
303305
public boolean isIOS() {
306+
if (browserDetails == null) {
307+
return false;
308+
}
304309
return browserDetails.isIOS();
305310
}
306311

@@ -327,6 +332,9 @@ public boolean isIPhone() {
327332
*/
328333
@Deprecated
329334
public boolean isIPad() {
335+
if (browserDetails == null) {
336+
return false;
337+
}
330338
return browserDetails.isIPad();
331339
}
332340

0 commit comments

Comments
 (0)