From 05e83ee63839d01d9ab9673c8d5de3535b4eea18 Mon Sep 17 00:00:00 2001 From: Mark Nelson Date: Sat, 20 Feb 2016 18:39:12 +0800 Subject: [PATCH] Fixed moving item issue If an item to swap was not found (so was equal to false) the function was still handling this as true as it was using 'isset', rather than '!empty'. --- classes/template.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/classes/template.php b/classes/template.php index e0add1a..a85107f 100644 --- a/classes/template.php +++ b/classes/template.php @@ -327,7 +327,7 @@ class template { } // Check that there is an item to move, and an item to swap it with. - if ($moveitem && isset($swapitem)) { + if ($moveitem && !empty($swapitem)) { $DB->set_field($table, 'sequence', $swapitem->sequence, array('id' => $moveitem->id)); $DB->set_field($table, 'sequence', $moveitem->sequence, array('id' => $swapitem->id)); }