ReVanced / revanced-cli

💻 Command-line application to use ReVanced
https://revanced.app
GNU General Public License v3.0
1.07k stars 168 forks source link

bug: java.lang.NullPointerException at MainCommand.kt:223 #186

Closed r3duc3 closed 1 year ago

r3duc3 commented 1 year ago

Type

Error while running the CLI

Bug description

when list patches with this command: java -jar revanced-cli-2.19.0-all.jar -a YouTube.v17.49.37-min26.apk -b revanced-patches-2.151.0.jar -l given error java.lang.NullPointerException

Steps to reproduce

Just want to get list of paches

Relevant log output

INFO:         always-autorepeat Always repeats the playing video again. 
INFO:           background-play Enables playing music in the background. 
INFO:           block-audio-ads Blocks audio ads in streams and VODs. 
INFO:        block-embedded-ads Blocks embedded steam ads using services like TTV.lol or PurpleAdBlocker. 
INFO:           block-video-ads Blocks video ads in streams and VODs. 
INFO:              client-spoof Spoofs the YouTube or Vanced client to prevent playback issues. 
INFO:              client-spoof Spoofs the YouTube or Vanced client to prevent playback issues. 
INFO:             codecs-unlock Adds more audio codec options. The new audio codecs usually result in better audio quality. 
INFO:                  comments Hides components related to comments. 
INFO:            compact-header Hides the music category bar at the top of the homepage. 
INFO:            copy-video-url Adds buttons in player to copy video links. 
INFO:           custom-branding Changes the YouTube launcher icon and name to your choice (defaults to ReVanced). 
INFO:       custom-video-buffer Lets you change the buffers of videos. 
INFO:        custom-video-speed Adds more video speed options. 
INFO:                debug-mode Enables Twitch's internal debugging mode. 
INFO:                 debugging Adds debugging options. 
INFO:               disable-ads Disables ads in HexEditor. 
INFO:     disable-auto-captions Disable forced captions from being automatically enabled. 
INFO: disable-auto-player-popup-panels  Disable automatic popup panels (playlist or live chat) on video player. 
INFO: disable-capture-restriction   Allows capturing Spotify's audio output while screen sharing or screen recording. 
INFO: disable-fullscreen-panels Disables video description and comments panel in fullscreen view. 
INFO: disable-login-requirement Do not force login. 
INFO: disable-login-requirement Do not force login. 
INFO: disable-startup-shorts-player Disables playing YouTube Shorts when launching YouTube. 
INFO:      disable-zoom-haptics Disables haptics when zooming. 
INFO:                 downloads Enables downloading music and videos from YouTube. 
INFO:             dynamic-color Replaces the default Twitter Blue with the users Material You palette. 
INFO:     enable-wide-searchbar Replaces the search icon with a wide search bar. This will hide the YouTube logo when active. 
INFO:  exclusive-audio-playback Enables the option to play music without video. 
INFO:               feed-filter Filters tiktok videos: removing ads, removing livestreams. 
INFO:               feed-filter Filters tiktok videos: removing ads, removing livestreams. 
INFO:          fix-google-login Allows logging in with a Google account. 
INFO:          fix-google-login Allows logging in with a Google account. 
INFO:               general-ads Removes general ads. 
INFO:        general-reddit-ads Removes general ads from the Reddit frontpage and subreddits. 
INFO:       hdr-auto-brightness Makes the brightness of HDR videos follow the system default. 
INFO:                  hide-ads Removes ads from TikTok. 
INFO:                  hide-ads Removes ads from TikTok. 
INFO:          hide-album-cards Hides the album cards below the artist description. 
INFO:          hide-artist-card Hides the artist card below the searchbar. 
INFO:      hide-autoplay-button Hides the autoplay button in the video player. 
INFO:  hide-breaking-news-shelf Hides the breaking news shelf on the homepage tab. 
INFO:      hide-captions-button Hides the captions button on video player. 
INFO:          hide-cast-button Hides the cast button in the video player. 
INFO:        hide-create-button Hides the create button in the navigation bar. 
INFO:     hide-crowdfunding-box Hides the crowdfunding box between the player and video description. 
INFO:        hide-email-address Hides the email address in the account switcher. 
INFO:      hide-endscreen-cards Hides the suggested video cards at the end of a video in fullscreen. 
INFO:          hide-get-premium Removes all "Get Premium" evidences from the avatar menu. 
INFO:           hide-info-cards Hides info-cards in videos. 
INFO:               hide-my-mix Hides mix playlists. 
INFO:       hide-premium-navbar Removes the premium tab from the navbar. 
INFO:        hide-shorts-button Hides the shorts button on the navigation bar. 
INFO:     hide-time-and-seekbar Hides progress bar and time counter on videos. 
INFO:        hide-video-buttons Adds options to hide action buttons under a video. 
INFO:          hide-views-stats Hides the view stats under tweets. 
INFO:          hide-watch-in-vr Hides the Watch in VR option in the player settings flyout panel. 
INFO:            hide-watermark Hides creator's watermarks on videos. 
INFO:            microg-support Allows YouTube ReVanced to run without root and under a different package name with Vanced MicroG. 
INFO:        minimized-playback Enables minimized and background playback. 
INFO:  minimized-playback-music Enables minimized playback on Kids music. 
INFO:           monochrome-icon Adds a monochrome icon. 
INFO:      music-microg-support Allows YouTube Music ReVanced to run without root and under a different package name. 
INFO:           music-video-ads Removes ads in the music player. 
INFO:        old-quality-layout Enables the original video quality flyout in the video player settings 
INFO:       open-links-directly Bypasses URL redirects and opens links directly inside YouTube app. 
INFO:            playback-speed Enables the playback speed option for all videos. 
INFO:            playback-speed Enables the playback speed option for all videos. 
java.lang.NullPointerException
        at app.revanced.cli.command.MainCommand.printListOfPatches(MainCommand.kt:223)
        at app.revanced.cli.command.MainCommand.run(MainCommand.kt:127)
        at picocli.CommandLine.executeUserObject(CommandLine.java:2026)
        at picocli.CommandLine.access$1500(CommandLine.java:148)
        at picocli.CommandLine$RunLast.executeUserObjectOfLastSubcommandWithSameParent(CommandLine.java:2461)
        at picocli.CommandLine$RunLast.handle(CommandLine.java:2453)
        at picocli.CommandLine$RunLast.handle(CommandLine.java:2415)
        at picocli.CommandLine$AbstractParseResultHandler.execute(CommandLine.java:2273)
        at picocli.CommandLine$RunLast.execute(CommandLine.java:2417)
        at picocli.CommandLine.execute(CommandLine.java:2170)
        at app.revanced.cli.main.MainKt.main(Main.kt:7)

Screenshots or videos

No response

Solution

index 4ebd462..4a7513a 100644
--- a/src/main/kotlin/app/revanced/cli/command/MainCommand.kt
+++ b/src/main/kotlin/app/revanced/cli/command/MainCommand.kt
@@ -220,6 +220,7 @@ internal object MainCommand : Runnable {
         for (patchBundlePath in args.patchArgs?.patchBundles!!) for (patch in PatchBundle.Jar(patchBundlePath)
             .loadPatches()) {
             if (patch.patchName in logged) continue
+            if (patch.compatiblePackages === null) continue
             for (compatiblePackage in patch.compatiblePackages!!) {
                 val packageEntryStr = buildString {
                     // Add package if flag is set

Additional context

No response

Acknowledgements

oSumAtrIX commented 1 year ago

Fixed in #187.

oSumAtrIX commented 1 year ago

Please open an issue in the respective repository

oSumAtrIX commented 1 year ago

If it is a ReVanced CLI issue, open one in the respective repository