TypeError: Cannot read property 'indexOf' of null

Open
#450 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
35/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
javascript
Domain
tooling

Research direction

Start at the originalPositionFor and sourceContentFor entry points and reproduce the failure with a string obtained from an HTTP GET query. Trace the null mapping into sourceContentFor, then add coverage for the query-derived input and verify that the lookup no longer raises the reported TypeError.

Written by the indexing model from the issue text.

Description

Without using typescript or looking at the type declaration, the parameter obtained from http get query, which is passed into the originalPositionFor method as a string without processing, will result in null mapping. Then sourceContentFor will cause an error.

It is recommended that the display of the library author be converted to number, otherwise it will take a long time to check the problem and it is difficult to locate it. thank you!

image
image
image

Dominant language
JavaScript
Stars
3.7k
Forks
370
PR merge metrics
No merged PRs in 30d

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from mozilla/source-map

All issues in mozilla/source-map

Similar issues

More JavaScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.