Skip to content
This repository has been archived by the owner on Jul 18, 2023. It is now read-only.

Unhandled Rejection: TypeError: Cannot read properties of null (reading '0') #38

Closed
shrihankp opened this issue Jul 8, 2022 · 4 comments · Fixed by #40
Closed

Unhandled Rejection: TypeError: Cannot read properties of null (reading '0') #38

shrihankp opened this issue Jul 8, 2022 · 4 comments · Fixed by #40

Comments

@shrihankp
Copy link
Collaborator

shrihankp commented Jul 8, 2022

This occurs after all the downloads are finished.

If I comment the 'Unhandled exception/rejection' handlers, I get this:

/home/shrihan/revanced-builder/index.js:496
        patch += `| ${patchDescsArray[index]
                                     ^
TypeError: Cannot read properties of null (reading '0')
    at /home/shrihan/revanced-builder/index.js:497:38
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)

Node.js v18.4.0

...which basically refers to this chunk, i.e. where the patches and their descriptions are ripped from java -jar <cli.jar> -b <patches.jar> -l.

If I manually run that listing command:

INFO:    fenster-swipe-controls	Adds volume and brightness swipe controls. 
INFO:           seekbar-tapping	Enables tapping on the seekbar of the YouTube player. 
INFO:               general-ads	Removes general ads in bytecode. 
INFO:                 video-ads	Removes ads in the YouTube video player. 
INFO: hide-infocard-suggestions	Hides infocards in videos. 
INFO:           custom-branding	Change the branding of YouTube. 
INFO:           premium-heading	Show the premium branding on the the YouTube home screen. 
INFO:        minimized-playback	Enables minimized and background playback. 
INFO:     enable-wide-searchbar	Replaces the search icon with a wide search bar. This will hide the YouTube logo when active. 
INFO: disable-fullscreen-panels	Disables comments panel in fullscreen view. 
INFO:        old-quality-layout	Enables the original quality flyout menu. 
INFO:      hide-autoplay-button	Disables the autoplay button. 
INFO:     disable-create-button	Disables the create button. 
INFO:                    amoled	Enables pure black theme. 
INFO:        hide-shorts-button	Hides the shorts button. 
INFO:          hide-cast-button	Hides the cast button. 
INFO:            hide-watermark	Hides the creator's watermark on videos. 
INFO:            microg-support	Allows YouTube ReVanced to run without root and under a different package name. 
INFO:     custom-playback-speed	Allows to change the default playback speed options. 
INFO:        hdr-max-brightness	Sets brightness to max for HDR videos in fullscreen mode. 
INFO:          enable-debugging	Enables app debugging by patching the manifest file. 
INFO:           background-play	Enable playing music in the background. 
INFO:  exclusive-audio-playback	Adds the option to play music without video. 
INFO:             codecs-unlock	Enables more audio codecs. Usually results in better audio quality but may depend on song and device. 
INFO:    upgrade-button-remover	Removes the upgrade tab from the pivot bar in YouTube music. 
INFO:      tasteBuilder-remover	Removes the "Tell us which artists you like" card from the Home screen. The same functionality can be triggered from the settings anyway. 

I'm guessing the error's because of those extra spaces after "INFO:" to format the patch name and it's description.

@reisxd
Copy link
Owner

reisxd commented Jul 8, 2022

Hey, can you try logging getPatches and patchDescsArray? Because this doesn't happen on my pc.
The stdout of getPatches should be something like INFO: fenster-swipe-controls\tAdds volume and brightness swipe controls. \r\n, if not, please send the full log!

@reisxd
Copy link
Owner

reisxd commented Jul 8, 2022

Also about those spaces: I don't think thats the issue. I get the description of the patches by using a RegEx.
https://github.com/reisxd/revanced-builder/blob/main/index.js#L487-#L489

@shrihankp
Copy link
Collaborator Author

shrihankp commented Jul 9, 2022

Hey, can you try logging getPatches and patchDescsArray? Because this doesn't happen on my pc. The stdout of getPatches should be something like INFO: fenster-swipe-controls\tAdds volume and brightness swipe controls. \r\n

When I do that:

{
  stdout: 'INFO:    fenster-swipe-controls\tAdds volume and brightness swipe controls. \n' +
    'INFO:           seekbar-tapping\tEnables tapping on the seekbar of the YouTube player. \n' +
    'INFO:               general-ads\tRemoves general ads in bytecode. \n' +
    'INFO:                 video-ads\tRemoves ads in the YouTube video player. \n' +
    'INFO: hide-infocard-suggestions\tHides infocards in videos. \n' +
    'INFO:           custom-branding\tChange the branding of YouTube. \n' +
    'INFO:           premium-heading\tShow the premium branding on the the YouTube home screen. \n' +
    'INFO:        minimized-playback\tEnables minimized and background playback. \n' +
    'INFO:     enable-wide-searchbar\tReplaces the search icon with a wide search bar. This will hide the YouTube logo when active. \n' +
    'INFO: disable-fullscreen-panels\tDisables comments panel in fullscreen view. \n' +
    'INFO:        old-quality-layout\tEnables the original quality flyout menu. \n' +
    'INFO:      hide-autoplay-button\tDisables the autoplay button. \n' +
    'INFO:     disable-create-button\tDisables the create button. \n' +
    'INFO:                    amoled\tEnables pure black theme. \n' +
    'INFO:        hide-shorts-button\tHides the shorts button. \n' +
    'INFO:          hide-cast-button\tHides the cast button. \n' +
    "INFO:            hide-watermark\tHides the creator's watermark on videos. \n" +
    'INFO:            microg-support\tAllows YouTube ReVanced to run without root and under a different package name. \n' +
    'INFO:     custom-playback-speed\tAllows to change the default playback speed options. \n' +
    'INFO:        hdr-max-brightness\tSets brightness to max for HDR videos in fullscreen mode. \n' +
    'INFO:          enable-debugging\tEnables app debugging by patching the manifest file. \n' +
    'INFO:           background-play\tEnable playing music in the background. \n' +
    'INFO:  exclusive-audio-playback\tAdds the option to play music without video. \n' +
    'INFO:             codecs-unlock\tEnables more audio codecs. Usually results in better audio quality but may depend on song and device. \n' +
    'INFO:    upgrade-button-remover\tRemoves the upgrade tab from the pivot bar in YouTube music. \n' +
    'INFO:      tasteBuilder-remover\tRemoves the "Tell us which artists you like" card from the Home screen. The same functionality can be triggered from the settings anyway. \n',
  stderr: ''
}
null
/data/data/com.termux/files/home/revanced-builder/index.js:499
        patch += `| ${patchDescsArray[index]
                                     ^

TypeError: Cannot read properties of null (reading '0')
    at /data/data/com.termux/files/home/revanced-builder/index.js:499:38
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)

Node.js v18.4.0

Yeah, the stdout doesn't really have \t, but literal spaces . Nothing, forget it 😅

patchDescsArray is null, thus it cannot get something from that, hence the error.

@reisxd
Copy link
Owner

reisxd commented Jul 9, 2022

Hey, can you try logging getPatches and patchDescsArray? Because this doesn't happen on my pc. The stdout of getPatches should be something like INFO: fenster-swipe-controls\tAdds volume and brightness swipe controls. \r\n

When I do that:

{
  stdout: 'INFO:    fenster-swipe-controls\tAdds volume and brightness swipe controls. \n' +
    'INFO:           seekbar-tapping\tEnables tapping on the seekbar of the YouTube player. \n' +
    'INFO:               general-ads\tRemoves general ads in bytecode. \n' +
    'INFO:                 video-ads\tRemoves ads in the YouTube video player. \n' +
    'INFO: hide-infocard-suggestions\tHides infocards in videos. \n' +
    'INFO:           custom-branding\tChange the branding of YouTube. \n' +
    'INFO:           premium-heading\tShow the premium branding on the the YouTube home screen. \n' +
    'INFO:        minimized-playback\tEnables minimized and background playback. \n' +
    'INFO:     enable-wide-searchbar\tReplaces the search icon with a wide search bar. This will hide the YouTube logo when active. \n' +
    'INFO: disable-fullscreen-panels\tDisables comments panel in fullscreen view. \n' +
    'INFO:        old-quality-layout\tEnables the original quality flyout menu. \n' +
    'INFO:      hide-autoplay-button\tDisables the autoplay button. \n' +
    'INFO:     disable-create-button\tDisables the create button. \n' +
    'INFO:                    amoled\tEnables pure black theme. \n' +
    'INFO:        hide-shorts-button\tHides the shorts button. \n' +
    'INFO:          hide-cast-button\tHides the cast button. \n' +
    "INFO:            hide-watermark\tHides the creator's watermark on videos. \n" +
    'INFO:            microg-support\tAllows YouTube ReVanced to run without root and under a different package name. \n' +
    'INFO:     custom-playback-speed\tAllows to change the default playback speed options. \n' +
    'INFO:        hdr-max-brightness\tSets brightness to max for HDR videos in fullscreen mode. \n' +
    'INFO:          enable-debugging\tEnables app debugging by patching the manifest file. \n' +
    'INFO:           background-play\tEnable playing music in the background. \n' +
    'INFO:  exclusive-audio-playback\tAdds the option to play music without video. \n' +
    'INFO:             codecs-unlock\tEnables more audio codecs. Usually results in better audio quality but may depend on song and device. \n' +
    'INFO:    upgrade-button-remover\tRemoves the upgrade tab from the pivot bar in YouTube music. \n' +
    'INFO:      tasteBuilder-remover\tRemoves the "Tell us which artists you like" card from the Home screen. The same functionality can be triggered from the settings anyway. \n',
  stderr: ''
}
null
/data/data/com.termux/files/home/revanced-builder/index.js:499
        patch += `| ${patchDescsArray[index]
                                     ^

TypeError: Cannot read properties of null (reading '0')
    at /data/data/com.termux/files/home/revanced-builder/index.js:499:38
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)

Node.js v18.4.0

Yeah, the stdout doesn't really have \t, but literal spaces . Nothing, forget it 😅

patchDescsArray is null, thus it cannot get something from that, hence the error.

I see, on my PC, it ends with \r\n, but here, it ends with \n. Shouldn't be hard to implement a small fix

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants