diff --git a/lib/private/Files/View.php b/lib/private/Files/View.php
index 58552be26096a4769101c87f475a501e1fc9487c..592d4b717ce136f4d7ac75bfbdb5824aea32ee0b 100644
--- a/lib/private/Files/View.php
+++ b/lib/private/Files/View.php
@@ -1362,6 +1362,9 @@ class View {
 		$path = Filesystem::normalizePath($this->fakeRoot . '/' . $path);
 
 		$mount = Filesystem::getMountManager()->find($path);
+		if (!$mount) {
+			return false;
+		}
 		$storage = $mount->getStorage();
 		$internalPath = $mount->getInternalPath($path);
 		if ($storage) {
@@ -1411,6 +1414,9 @@ class View {
 		$path = $this->getAbsolutePath($directory);
 		$path = Filesystem::normalizePath($path);
 		$mount = $this->getMount($directory);
+		if (!$mount) {
+			return [];
+		}
 		$storage = $mount->getStorage();
 		$internalPath = $mount->getInternalPath($path);
 		if ($storage) {
diff --git a/lib/private/Server.php b/lib/private/Server.php
index 3f26f975f0f8fca8ae66d9fd58a26dfee6af1c01..0dfbcbb75ecfd73ff6fe78ef1d53adc1c03b8e3e 100644
--- a/lib/private/Server.php
+++ b/lib/private/Server.php
@@ -118,6 +118,7 @@ use OCP\Defaults;
 use OCA\Theming\Util;
 use OCP\Federation\ICloudIdManager;
 use OCP\Authentication\LoginCredentials\IStore;
+use OCP\Files\NotFoundException;
 use OCP\ICacheFactory;
 use OCP\IDBConnection;
 use OCP\IL10N;
@@ -1151,6 +1152,8 @@ class Server extends ServerContainer implements IServerContainer {
 			try {
 				$avatar = $manager->getAvatar($user->getUID());
 				$avatar->remove();
+			} catch (NotFoundException $e) {
+				// no avatar to remove
 			} catch (\Exception $e) {
 				// Ignore exceptions
 				$logger->info('Could not cleanup avatar of ' . $user->getUID());