Skip to content

Commit b06cb67

Browse files
committed
add null check
1 parent 4f5699c commit b06cb67

File tree

1 file changed

+8
-3
lines changed
  • azure-functions-extension-base/azure/functions/extension/base

1 file changed

+8
-3
lines changed

azure-functions-extension-base/azure/functions/extension/base/web.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
from abc import abstractmethod
22
from enum import Enum
3+
import inspect
34
from typing import Callable
45

56
base_extension_module = __name__
@@ -53,7 +54,9 @@ def get_request_type(cls):
5354

5455
@classmethod
5556
def check_type(cls, pytype: type) -> bool:
56-
return cls._request_type is not None and issubclass(pytype, cls._request_type)
57+
if pytype is not None and inspect.isclass(pytype):
58+
return cls._request_type is not None and issubclass(pytype, cls._request_type)
59+
return False
5760

5861

5962
class ResponseTrackerMeta(type):
@@ -87,8 +90,10 @@ def get_response_type(cls, label):
8790

8891
@classmethod
8992
def check_type(cls, pytype: type) -> bool:
90-
return cls._response_types is not None and any(issubclass(pytype, response_type)
91-
for response_type in cls._response_types.values())
93+
if pytype is not None and inspect.isclass(pytype):
94+
return cls._response_types is not None and any(issubclass(pytype, response_type)
95+
for response_type in cls._response_types.values())
96+
return False
9297

9398
class WebApp(metaclass=ModuleTrackerMeta):
9499
@abstractmethod

0 commit comments

Comments
 (0)