Guard against NullPointerException in Compasslistenter

This commit is contained in:
Simon MacDonald 2012-10-24 16:29:02 -04:00
parent cba0d59021
commit 652f15f893

View File

@ -202,7 +202,9 @@ public class CompassListener extends CordovaPlugin implements SensorEventListene
private void timeout() {
if (this.status == CompassListener.STARTING) {
this.setStatus(CompassListener.ERROR_FAILED_TO_START);
this.callbackContext.error("Compass listener failed to start.");
if (this.callbackContext != null) {
this.callbackContext.error("Compass listener failed to start.");
}
}
}