From 1e12ae1884bb14409170402159a01e884ef5f330 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastia=CC=81n=20Katzer?= Date: Thu, 30 Jan 2014 18:22:07 +0100 Subject: [PATCH] Fix NullReferenceException in windows phone 8 (#3) --- src/wp8/BackgroundMode.cs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/wp8/BackgroundMode.cs b/src/wp8/BackgroundMode.cs index 323bd28..df69b20 100644 --- a/src/wp8/BackgroundMode.cs +++ b/src/wp8/BackgroundMode.cs @@ -1,5 +1,5 @@ /* - Copyright 2013 appPlant UG + Copyright 2013-2014 appPlant UG Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file @@ -127,7 +127,9 @@ namespace Cordova.Extension.Commands /// private static bool IsServiceAvailable() { - return !(Geolocator.LocationStatus == PositionStatus.Disabled || Geolocator.LocationStatus == PositionStatus.NotAvailable); + Geolocator geolocator = (Geolocator == null) ? new Geolocator() : Geolocator; + + return !(geolocator.LocationStatus == PositionStatus.Disabled || geolocator.LocationStatus == PositionStatus.NotAvailable); } } }