MurhafSousli / ngx-highlightjs

Angular syntax highlighting module
https://ngx-highlight.netlify.app/
MIT License
278 stars 35 forks source link

codeFromUrl display error message in the console even though it works. #141

Closed armoucar closed 4 years ago

armoucar commented 4 years ago

Bug Report or Feature Request (mark with an x)

- [x] bug report -> please search issues before submitting
- [ ] feature request
- [ ] question

Repro steps

https://stackblitz.com/edit/ngx-highlightjs-vandwp?file=src%2Fapp%2Fhome%2Fhome.component.ts

The log given by the failure

ERROR TypeError: Cannot read property 'replace' of null
    at escape (highlight.js:58)
    at Object.highlightAuto (highlight.js:569)
    at MapSubscriber.project (ngx-highlightjs.js:163)
    at MapSubscriber._next (map.js:29)
    at MapSubscriber.next (Subscriber.js:49)
    at TakeSubscriber._next (take.js:35)
    at TakeSubscriber.next (Subscriber.js:49)
    at FilterSubscriber._next (filter.js:33)
    at FilterSubscriber.next (Subscriber.js:49)
    at BehaviorSubject.next (Subject.js:39)

Desired functionality

Even though codeFromUrl works in the end, it throws an error message in the console. First it executes with null and after with the fetched code.

MurhafSousli commented 4 years ago

Fixed in v4.1.2