chjj / blessed

A high-level terminal interface library for node.js.
Other
11.2k stars 528 forks source link

fix null attr access #431

Open AhmedMozaly opened 1 year ago

AhmedMozaly commented 1 year ago

I'm using blessed as part of PM2 setup Noticed that PM2 monit command works for some apps but not for other, after checking the issue. It was this error

TypeError: Cannot read properties of null (reading 'slice')
    at /Users/ahmed/.nvm/versions/node/v18.16.0/lib/node_modules/pm2/node_modules/blessed/lib/program.js:2543:35
    at Array.forEach (<anonymous>)
    at Program._attr (/Users/ahmed/.nvm/versions/node/v18.16.0/lib/node_modules/pm2/node_modules/blessed/lib/program.js:2542:11)
    at Element._parseTags (/Users/ahmed/.nvm/versions/node/v18.16.0/lib/node_modules/pm2/node_modules/blessed/lib/widgets/element.js:498:26)
    at Element.parseContent (/Users/ahmed/.nvm/versions/node/v18.16.0/lib/node_modules/pm2/node_modules/blessed/lib/widgets/element.js:393:22)
    at Box.<anonymous> (/Users/ahmed/.nvm/versions/node/v18.16.0/lib/node_modules/pm2/node_modules/blessed/lib/widgets/element.js:184:10)
    at EventEmitter._emit (/Users/ahmed/.nvm/versions/node/v18.16.0/lib/node_modules/pm2/node_modules/blessed/lib/events.js:94:20)
    at EventEmitter.emit (/Users/ahmed/.nvm/versions/node/v18.16.0/lib/node_modules/pm2/node_modules/blessed/lib/events.js:117:12)
    at emit (/Users/ahmed/.nvm/versions/node/v18.16.0/lib/node_modules/pm2/node_modules/blessed/lib/widgets/node.js:109:15)
    at Node.insert (/Users/ahmed/.nvm/versions/node/v18.16.0/lib/node_modules/pm2/node_modules/blessed/lib/widgets/node.js:111:5)

This PR should fix this noisy issue

MrFiregore commented 8 months ago

happens when there are square brackets as tags, but only opening brackets

for example when passing this text:


> open-with-jetbrains@1.0.0 build C:\www\open-con-jetbrains
> pnpm run build:clean && pnpm run build:tsc && pnpm run build:di

> open-with-jetbrains@1.0.0 build:clean C:\www\open-con-jetbrains
> del-cli --force --verbose dist

C:www\open-con-jetbrains\dist

> open-with-jetbrains@1.0.0 build:tsc C:\www\open-con-jetbrains
> tsc -p tsconfig.json

> open-with-jetbrains@1.0.0 build:di C:\www\open-con-jetbrains
> copyfiles -V -u 1 ./src/**/*.{json,yaml,html,png,hbs} ./dist

unglobed path: ./src/config.default.json

Note that {json,yaml,html,png,hbs} is not a tag.