From e850d17e296812e44101e8fd248930c8f881a563 Mon Sep 17 00:00:00 2001 From: Joseph Schorr <jschorr@gmail.com> Date: Thu, 3 Jul 2014 17:18:14 -0400 Subject: [PATCH] Handle potential NPE in the registry code --- endpoints/registry.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/endpoints/registry.py b/endpoints/registry.py index f650398ec..bd78e6055 100644 --- a/endpoints/registry.py +++ b/endpoints/registry.py @@ -412,6 +412,11 @@ def put_image_json(namespace, repository, image_id): profile.debug('Looking up repo image') repo_image = model.get_repo_image(namespace, repository, image_id) + if not repo_image: + profile.debug('Image not found') + abort(404, 'Image %(image_id)s not found', issue='unknown-image', + image_id=image_id) + uuid = repo_image.storage.uuid if image_id != data['id']: