From a4a11ad1ab0a594da7b5844126924466638db496 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cristi=20V=C3=AEjdea?= Date: Mon, 14 May 2018 22:10:13 +0300 Subject: [PATCH] Prevent crash when ViewInspector.get_operation returns None --- src/drf_yasg/generators.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/drf_yasg/generators.py b/src/drf_yasg/generators.py index 4e2d556..c806143 100644 --- a/src/drf_yasg/generators.py +++ b/src/drf_yasg/generators.py @@ -367,6 +367,9 @@ class OpenAPISchemaGenerator(object): view_inspector = view_inspector_cls(view, path, method, components, request, overrides) operation = view_inspector.get_operation(operation_keys) + if operation is None: + return None + if 'consumes' in operation and set(operation.consumes) == set(self.consumes): del operation.consumes if 'produces' in operation and set(operation.produces) == set(self.produces):