diff --git a/src/main/java/de/thm/arsnova/dao/CouchDBDao.java b/src/main/java/de/thm/arsnova/dao/CouchDBDao.java index 3fc04e23645984cc93347807db686ad5a724f35b..d7ef90a55762ba209b72873282a24af4d45cf866 100644 --- a/src/main/java/de/thm/arsnova/dao/CouchDBDao.java +++ b/src/main/java/de/thm/arsnova/dao/CouchDBDao.java @@ -873,6 +873,9 @@ public class CouchDBDao implements IDatabaseDao { view.setKey(URLEncoder.encode("\"" + questionId + "\"", "UTF-8")); view.setGroup(true); ViewResults results = this.getDatabase().view(view); + if (results.getResults().size() == 0) { + return 0; + } return results.getJSONArray("rows").optJSONObject(0).optInt("value"); } catch (UnsupportedEncodingException e) { LOGGER.error("Error while retrieving answer count", e);