MDL-46433 blog: fix error message when creating an external blog
authorSimey Lameze <simey@moodle.com>
Wed, 23 Jul 2014 06:54:10 +0000 (14:54 +0800)
committerSimey Lameze <simey@moodle.com>
Wed, 23 Jul 2014 08:11:20 +0000 (16:11 +0800)
blog/lib.php

index 5b26916..b9cbae5 100644 (file)
@@ -180,9 +180,11 @@ function blog_sync_external_entries($externalblog) {
             $filtertags = array_map('trim', $filtertags);
             $filtertags = array_map('strtolower', $filtertags);
 
-            foreach ($categories as $category) {
-                if (in_array(trim(strtolower($category->term)), $filtertags)) {
-                    $containsfiltertag = true;
+            if (!empty($categories)) {
+                foreach ($categories as $category) {
+                    if (in_array(trim(strtolower($category->term)), $filtertags)) {
+                        $containsfiltertag = true;
+                    }
                 }
             }