Skip to content

Commit

Permalink
handle null dep.idRangeStarts
Browse files Browse the repository at this point in the history
  • Loading branch information
bworline committed May 31, 2023
1 parent 34eba0d commit 5ab7e50
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion lib/dependencies/HarmonyImportSpecifierDependency.js
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,10 @@ HarmonyImportSpecifierDependency.Template = class HarmonyImportSpecifierDependen
// Meaning, the two arrays may not always have the same number of elements, but the last element of
// dep.idRangeStarts corresponds to [the starting range position of] the last element of dep.getIds.
// Use this to find the correct range end position based on the number of ids that were trimmed.
const idx = dep.idRangeStarts.length + (trimmedIds.length - ids.length);
const idx =
dep.idRangeStarts === undefined
? -1 /* trigger failure case below */
: dep.idRangeStarts.length + (trimmedIds.length - ids.length);
if (idx < 0 || idx >= dep.idRangeStarts.length) {
// cspell:ignore minifiers
// Should not happen but we can't throw an error here because of backward compatibility with
Expand Down

0 comments on commit 5ab7e50

Please sign in to comment.