MurhafSousli / ngx-highlightjs

Angular syntax highlighting module

Home Page:https://ngx-highlight.netlify.app/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

armoucar opened this issue · comments

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.

Fixed in v4.1.2