From: Alexandre Terrasa Date: Wed, 24 Jun 2015 23:06:24 +0000 (-0400) Subject: lib/mongodb: collections do not call next when returning only one element X-Git-Tag: v0.7.9~31^2~1 X-Git-Url: http://nitlanguage.org lib/mongodb: collections do not call next when returning only one element Signed-off-by: Alexandre Terrasa --- 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