From 9d22f7297c977b93f3346e649d9a520fba4109d4 Mon Sep 17 00:00:00 2001 From: Chad Horohoe Date: Fri, 15 Jul 2011 16:59:38 +0000 Subject: [PATCH] Slightly more informative error message when passed a bogus key (rather than property of non-object) --- includes/upload/UploadStash.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/includes/upload/UploadStash.php b/includes/upload/UploadStash.php index 75e0b2bbea..6b6dfff5f9 100644 --- a/includes/upload/UploadStash.php +++ b/includes/upload/UploadStash.php @@ -353,6 +353,10 @@ class UploadStash { __METHOD__ ); + if( !$row ) { + throw new UploadStashNoSuchKeyException( "No such key ($key), cannot remove" ); + } + if ( $row->us_user != $this->userId ) { throw new UploadStashWrongOwnerException( "Can't delete: the file ($key) doesn't belong to this user." ); } @@ -690,3 +694,4 @@ class UploadStashZeroLengthFileException extends MWException {}; class UploadStashNotLoggedInException extends MWException {}; class UploadStashWrongOwnerException extends MWException {}; class UploadStashMaxLagExceededException extends MWException {}; +class UploadStashNoSuchKeyException extends MWException {}; -- 2.20.1