aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2013-01-12 14:35:50 +1300
committerAnton Tananaev <anton.tananaev@gmail.com>2013-01-12 14:35:50 +1300
commit1f5489c0188dd3e063b9e226891f0fce662ee4b4 (patch)
treea6074e4538ba8c832f9fe6dd62a9d80e65a81df2
parent9f60706d957a183433cd61de9e422e565a1f15d4 (diff)
downloadtrackermap-web-1f5489c0188dd3e063b9e226891f0fce662ee4b4.tar.gz
trackermap-web-1f5489c0188dd3e063b9e226891f0fce662ee4b4.tar.bz2
trackermap-web-1f5489c0188dd3e063b9e226891f0fce662ee4b4.zip
Fix null pointer exception with 0 devices
-rw-r--r--src/org/traccar/web/server/model/DataServiceImpl.java2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/org/traccar/web/server/model/DataServiceImpl.java b/src/org/traccar/web/server/model/DataServiceImpl.java
index fa7a42d8..a1ea80be 100644
--- a/src/org/traccar/web/server/model/DataServiceImpl.java
+++ b/src/org/traccar/web/server/model/DataServiceImpl.java
@@ -193,7 +193,7 @@ public class DataServiceImpl extends RemoteServiceServlet implements DataService
public List<Position> getLatestPositions() {
List<Position> positions = new LinkedList<Position>();
User user = getUser();
- if (!user.getDevices().isEmpty()) {
+ if (user.getDevices() != null && !user.getDevices().isEmpty()) {
TypedQuery<Position> query = entityManager.createQuery(
"SELECT x FROM Position x WHERE x.id IN (" +
"SELECT y.latestPosition FROM Device y WHERE y IN (:devices))", Position.class);