From 3451c8702a2e16e5be2057ddd90f0d70aa7c8fc7 Mon Sep 17 00:00:00 2001 From: Arnesh Banerjee Date: Fri, 24 Jul 2026 04:56:17 +0530 Subject: [PATCH] return 404 when annotator association is not found in _editAnnotator The query could return None if the annotatorId doesn't match any AnnotatorAssociation for the given experiment, which caused an AttributeError crash on annotatorDetails.start. Added a null check that returns a 404 JSON response instead. Fixes #70 --- rapidannotator/modules/add_experiment/views.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/rapidannotator/modules/add_experiment/views.py b/rapidannotator/modules/add_experiment/views.py index 245b7a3..39165dc 100644 --- a/rapidannotator/modules/add_experiment/views.py +++ b/rapidannotator/modules/add_experiment/views.py @@ -1038,6 +1038,9 @@ def _editAnnotator(): experiment_id=experimentId, user_id=annotatorId).first() + if annotatorDetails is None: + return jsonify({'success': False, 'message': 'Annotator not found for this experiment'}), 404 + annotatorDetails.start = request.args.get('start', annotatorDetails.start) annotatorDetails.end = request.args.get('end', annotatorDetails.end) annotatorDetails.current = 0