diff --git a/packages/api-explorer/__tests__/index.test.jsx b/packages/api-explorer/__tests__/index.test.jsx
index 1079a5f06..399ce3c68 100644
--- a/packages/api-explorer/__tests__/index.test.jsx
+++ b/packages/api-explorer/__tests__/index.test.jsx
@@ -151,13 +151,26 @@ describe('oas', () => {
expect(explorer.find('Doc').get(0).props.oas).toBe(oas);
});
+ // Of course... `typeof null === 'object'`
+ it('should not error if `doc.api.apiSetting` is null', () => {
+ const explorer = shallow(
+ ,
+ );
+
+ expect(explorer.find('Doc').get(0).props.oas).toEqual({});
+ });
+
it('should set it to empty object', () => {
const explorer = shallow(
,
);
diff --git a/packages/api-explorer/src/index.jsx b/packages/api-explorer/src/index.jsx
index 803090729..8ddbb3f0c 100644
--- a/packages/api-explorer/src/index.jsx
+++ b/packages/api-explorer/src/index.jsx
@@ -50,7 +50,7 @@ class ApiExplorer extends React.Component {
const apiSetting =
doc.category.apiSetting ||
(typeof doc.api.apiSetting === 'string' && doc.api.apiSetting) ||
- (typeof doc.api.apiSetting === 'object' && doc.api.apiSetting._id);
+ (typeof doc.api.apiSetting === 'object' && doc.api.apiSetting && doc.api.apiSetting._id);
return this.props.oasFiles[apiSetting];
}