diff --git a/scp/canned.php b/scp/canned.php
index 4a5447525d5dc6c995641ada7dabe379b0e35f20..a600cee5ab0cab61cfc65bb6ad50e5f10b123a83 100644
--- a/scp/canned.php
+++ b/scp/canned.php
@@ -85,11 +85,11 @@ if($_POST && $thisstaff->canManageCannedResponses()) {
                 $_REQUEST['a']=null;
                 //Upload attachments
                 $keepers = $canned_form->getField('attachments')->getClean();
-                if ($keepers && ($c=Canned::lookup($id)))
+                if (($c=Canned::lookup($id)) && $keepers)
                     $c->attachments->upload($keepers);
 
                 // Attach inline attachments from the editor
-                if (isset($_POST['draft_id'])
+                if ($c && isset($_POST['draft_id'])
                         && ($draft = Draft::lookup($_POST['draft_id'])))
                     $c->attachments->upload(
                         $draft->getAttachmentIds($_POST['response']), true);