summaryrefslogtreecommitdiff
path: root/inc
diff options
context:
space:
mode:
author8chan <admin@8chan.co>2015-04-20 04:20:17 -0700
committerczaks <marcin@6irc.net>2016-05-05 13:21:09 +0200
commit6b04b3c671fdcaa85be97c14336219217b193cc5 (patch)
treef89c72fe6c9390c239085e8d89e802fd6f053f90 /inc
parent5f10badee90cadee42e051a10dbefb2a54045d5d (diff)
Fix post deletion
Diffstat (limited to 'inc')
-rwxr-xr-xinc/functions.php2
1 files changed, 2 insertions, 0 deletions
diff --git a/inc/functions.php b/inc/functions.php
index c50336ae..c46807bb 100755
--- a/inc/functions.php
+++ b/inc/functions.php
@@ -1130,6 +1130,8 @@ function deleteFile($id, $remove_entirely_if_already=true, $file=null) {
$files = json_decode($post['files']);
$file_to_delete = $file !== false ? $files[(int)$file] : (object)array('file' => false);
+ if (!$files[0]) error(_('That post has no files.'));
+
if ($files[0]->file == 'deleted' && $post['num_files'] == 1 && !$post['thread'])
return; // Can't delete OP's image completely.