diff --git a/sql/ha_ndbcluster.cc b/sql/ha_ndbcluster.cc
index 155e220237d..0f4d9630fe1 100644
--- a/sql/ha_ndbcluster.cc
+++ b/sql/ha_ndbcluster.cc
@@ -1344,7 +1344,7 @@ int ha_ndbcluster::ordered_index_scan(const key_range *start_key,
 
   NdbOperation::LockMode lm=
     (NdbOperation::LockMode)get_ndb_lock_type(m_lock.type);
-  if ((op= trans->getNdbIndexScanOperation((NDBINDEX *)
+  if (!(op= trans->getNdbIndexScanOperation((NDBINDEX *)
 					   m_index[active_index].index, 
 					   (const NDBTAB *) m_table)) ||
       !(cursor= op->readTuples(lm, 0, parallelism, sorted)))