Skip to content

Commit 71aeacf

Browse files
Exterskybrettz9
authored andcommitted
fix: add null checks
1 parent 57c9c19 commit 71aeacf

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/exportParser.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,9 @@ const mapVariables = function (node, globals) {
216216
} case 'ExportNamedDeclaration': {
217217
if (node.declaration) {
218218
const symbol = createSymbol(node.declaration, globals, node.declaration);
219-
symbol.exported = true;
219+
if (symbol) {
220+
symbol.exported = true;
221+
}
220222
}
221223
node.specifiers.forEach((specifier) => {
222224
mapVariables(specifier, globals);
@@ -237,7 +239,7 @@ const mapVariables = function (node, globals) {
237239

238240
const findNode = function (node, block, cache) {
239241
let blockCache = cache || [];
240-
if (blockCache.includes(block)) {
242+
if (!block || blockCache.includes(block)) {
241243
return false;
242244
}
243245
blockCache = blockCache.slice();
@@ -263,6 +265,9 @@ const findNode = function (node, block, cache) {
263265
};
264266

265267
const findExportedNode = function (block, node, cache) {
268+
if (block === null) {
269+
return false;
270+
}
266271
const blockCache = cache || [];
267272
for (const key in block.props) {
268273
if (Object.prototype.hasOwnProperty.call(block.props, key)) {

0 commit comments

Comments
 (0)