Fix NullReferenceException in windows phone 8 (#3)

This commit is contained in:
Sebastián Katzer 2014-01-30 18:22:07 +01:00
parent 7d193b9330
commit 1e12ae1884

View File

@ -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
/// </summary>
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);
}
}
}