From fdecee1bda0641eb0d1f215663a60a4ad559a6b8 Mon Sep 17 00:00:00 2001
From: Thomas Tanghus <thomas@tanghus.net>
Date: Thu, 13 Sep 2012 17:30:26 +0200
Subject: [PATCH] Check if categories is an array.

---
 lib/vcategories.php | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/lib/vcategories.php b/lib/vcategories.php
index f5123adeeb..6b1d6a316f 100644
--- a/lib/vcategories.php
+++ b/lib/vcategories.php
@@ -55,7 +55,10 @@ class OC_VCategories {
 		$this->app = $app;
 		$this->user = is_null($user) ? OC_User::getUser() : $user;
 		$categories = trim(OC_Preferences::getValue($this->user, $app, self::PREF_CATEGORIES_LABEL, ''));
-		$this->categories = $categories != '' ? @unserialize($categories) : $defcategories;
+		if ($categories) {
+			$categories = @unserialize($categories);
+		}
+		$this->categories = is_array($categories) ? $categories : $defcategories;
 	}
 
 	/**
-- 
GitLab