diff --git a/lib/private/Files/View.php b/lib/private/Files/View.php
index 90ac1e1988d360ddbdaf8f024b781d33936b5e92..8ea94626a2aaaf012918f1107443478f9fe8f5aa 100644
--- a/lib/private/Files/View.php
+++ b/lib/private/Files/View.php
@@ -1687,6 +1687,11 @@ class View {
 		if (!$info) {
 			throw new NotFoundException($path . ' not found while trying to get owner');
 		}
+
+		if ($info->getOwner() === null) {
+			throw new NotFoundException($path . ' has no owner');
+		}
+
 		return $info->getOwner()->getUID();
 	}