From 029bfa809aac6c38096d9cf59929b76eb124195c Mon Sep 17 00:00:00 2001 From: Paulo Gustavo Veiga Date: Tue, 18 Sep 2012 10:47:14 -0300 Subject: [PATCH] Fix NPE on Firefox mobile. --- .../com/wisemapping/filter/SupportedUserAgent.java | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/wise-webapp/src/main/java/com/wisemapping/filter/SupportedUserAgent.java b/wise-webapp/src/main/java/com/wisemapping/filter/SupportedUserAgent.java index ff4af213..e20fab27 100644 --- a/wise-webapp/src/main/java/com/wisemapping/filter/SupportedUserAgent.java +++ b/wise-webapp/src/main/java/com/wisemapping/filter/SupportedUserAgent.java @@ -44,14 +44,15 @@ public class SupportedUserAgent implements Serializable { final Version version = userAgent.getBrowserVersion(); final OperatingSystem os = userAgent.getOperatingSystem(); - boolean result = browser == Browser.FIREFOX && Integer.parseInt(version.getMajorVersion()) >= 10; + final String majorVersion = version.getMajorVersion(); + boolean result = browser == Browser.FIREFOX && Integer.parseInt(majorVersion) >= 10; result = result || browser == Browser.IE8 || browser == Browser.IE9; - result = result || browser == Browser.IE && Integer.parseInt(version.getMajorVersion()) >= 8; - result = result || browser == Browser.OPERA && Integer.parseInt(version.getMajorVersion()) >= 11; - result = result || browser == Browser.CHROME && Integer.parseInt(version.getMajorVersion()) >= 18; + result = result || browser == Browser.IE && Integer.parseInt(majorVersion) >= 8; + result = result || browser == Browser.OPERA && Integer.parseInt(majorVersion) >= 11; + result = result || browser == Browser.CHROME && Integer.parseInt(majorVersion) >= 18; result = result || browser == Browser.SAFARI5; - result = result || browser == Browser.SAFARI && Integer.parseInt(version.getMajorVersion()) >= 5; - result = result || browser == Browser.MOBILE_SAFARI && Integer.parseInt(version.getMajorVersion()) >= 5; + result = result || browser == Browser.SAFARI && Integer.parseInt(majorVersion) >= 5; + result = result || browser == Browser.MOBILE_SAFARI; result = result || os.isMobileDevice() && (os == OperatingSystem.ANDROID || os == OperatingSystem.iOS4_IPHONE); result = result || browser.getBrowserType() == BrowserType.ROBOT;