Send 404 if a note cannot be found
[grauphel.git] / controller / notescontroller.php
index 02bfc93..5618bcb 100644 (file)
@@ -58,6 +58,11 @@ class NotesController extends Controller
     public function xml($guid)
     {
         $note = $this->getNotes()->load($guid, false);
     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();
 
         $xw = new \XMLWriter();
         $xw->openMemory();