checking that there remain $oldwrappedids before deleting them lines 87-..
[moodle.git] / question / type / multianswer / questiontype.php
index 7f3fe1f..fc65b95 100644 (file)
@@ -84,8 +84,10 @@ class embedded_cloze_qtype extends default_questiontype {
         }
 
         // Delete redundant wrapped questions
-        $oldwrappedids = implode(',', $oldwrappedids);
-        delete_records_select('question', "id IN ($oldwrappedids)");
+        if(is_array($oldwrappedids) && count($oldwrappedids)){ 
+            $oldwrappedids = implode(',', $oldwrappedids);
+            delete_records_select('question', "id IN ($oldwrappedids)");
+        }
 
         if (!empty($sequence)) {
             $multianswer = new stdClass;