From 941110fe1b7c68f63f7179fc6bcfc0e5f38b798e Mon Sep 17 00:00:00 2001 From: Alexandre Terrasa Date: Wed, 24 Jun 2015 19:06:24 -0400 Subject: [PATCH] lib/mongodb: collections do not call next when returning only one element Signed-off-by: Alexandre Terrasa --- lib/mongodb/mongodb.nit | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/lib/mongodb/mongodb.nit b/lib/mongodb/mongodb.nit index 1e9b9bd..416e36b 100644 --- a/lib/mongodb/mongodb.nit +++ b/lib/mongodb/mongodb.nit @@ -604,10 +604,7 @@ class MongoCollection assert is_alive # FIXME used to avoid segfault (so `self` isn't garbage collected to soon) if c == null then return null var cursor = new MongoCursor(c) - if cursor.is_ok then - cursor.next - return cursor.item - end + if cursor.is_ok then return cursor.item return null end -- 1.7.9.5