Use hasInstance on public static getters of Mapbox.java (#128)

This commit is contained in:
Tobrun
2020-01-07 13:35:50 +01:00
committed by GitHub
parent d8fc70eacd
commit 2da60d28fd

View File

@@ -115,7 +115,7 @@ public final class Mapbox {
* @return the SKU token
*/
public static String getSkuToken() {
if (INSTANCE.accounts == null) {
if (!hasInstance() || INSTANCE.accounts == null) {
throw new MapboxConfigurationException(
"A valid access token parameter is required when using a Mapbox service."
+ "\nPlease see https://www.mapbox.com/help/create-api-access-token/ to learn how to create one."
@@ -179,7 +179,7 @@ public final class Mapbox {
*/
@Nullable
public static TelemetryDefinition getTelemetry() {
return INSTANCE.telemetry;
return hasInstance() ? INSTANCE.telemetry : null;
}
/**