From 4e9ff4d9da9a5bd324f7e00df33d606c59c157c2 Mon Sep 17 00:00:00 2001 From: Andreas Schildbach Date: Mon, 10 Dec 2018 10:43:26 +0100 Subject: [PATCH] SuggestLocationsResult: Assert for OK status in getLocations(). --- .../src/de/schildbach/pte/dto/SuggestLocationsResult.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/enabler/src/de/schildbach/pte/dto/SuggestLocationsResult.java b/enabler/src/de/schildbach/pte/dto/SuggestLocationsResult.java index b23c8084..0fc7d9d5 100644 --- a/enabler/src/de/schildbach/pte/dto/SuggestLocationsResult.java +++ b/enabler/src/de/schildbach/pte/dto/SuggestLocationsResult.java @@ -1,5 +1,5 @@ /* - * Copyright 2014-2015 the original author or authors. + * Copyright the original author or authors. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -18,6 +18,7 @@ package de.schildbach.pte.dto; import static com.google.common.base.Preconditions.checkNotNull; +import static com.google.common.base.Preconditions.checkState; import java.io.Serializable; import java.util.ArrayList; @@ -57,10 +58,10 @@ public final class SuggestLocationsResult implements Serializable { } public List getLocations() { + checkState(status == Status.OK, "no locations with status: {}", status); final List locations = new ArrayList<>(suggestedLocations.size()); for (final SuggestedLocation location : suggestedLocations) locations.add(location.location); - return locations; }