Send 404 if a note cannot be found
[grauphel.git] / controller / notescontroller.php
index 02bfc93eae1fc7f0fb16f7a2b01494582a643e1d..5618bcbb04b33473e9be78a88cb36e4abe4dc4bf 100644 (file)
@@ -58,6 +58,11 @@ class NotesController extends Controller
     public function xml($guid)
     {
         $note = $this->getNotes()->load($guid, false);
+        if ($note === null) {
+            $res = new ErrorResponse('Note does not exist');
+            $res->setStatus(\OCP\AppFramework\Http::STATUS_NOT_FOUND);
+            return $res;
+        }
 
         $xw = new \XMLWriter();
         $xw->openMemory();