diff --git a/lib/private/files/filesystem.php b/lib/private/files/filesystem.php
index 7e27650c5574d80bb57ac9b38d47afbe032e05ff..434ee495870ca44c41b5b2f0083ce2475be8016c 100644
--- a/lib/private/files/filesystem.php
+++ b/lib/private/files/filesystem.php
@@ -374,6 +374,9 @@ class Filesystem {
 	 * Returns path like /admin/files
 	 */
 	static public function getRoot() {
+		if (!self::$defaultInstance) {
+			return null;
+		}
 		return self::$defaultInstance->getRoot();
 	}