fabianonline / telegram_backup

Java app to download all your telegram data.
GNU General Public License v3.0
448 stars 91 forks source link

NullPointerException when using --anonymize with no accounts logged in #73

Closed mgrandi closed 6 years ago

mgrandi commented 6 years ago

Trying to login for the first time when using --anonymize produces a NullPointerException rather than asking you to login (found this when trying to reproduce another bug and forgot --target so it was looking in ~/.telegram_backup which had no logged in accounts)

without --anonymize

130 mark@kramidnarg:~/telegram_backup_debugging⟫ java -jar telegram_backup.jar
Telegram_Backup version 1.1.0, Copyright (C) 2016, 2017 Fabian Schlenz

Telegram_Backup comes with ABSOLUTELY NO WARRANTY. This is free software, and you are
welcome to redistribute it under certain conditions; run it with '--license' for details.

Base directory for files: /home/mark/.telegram_backup
No accounts found. Starting login process...
Please enter your phone number in international format.
Example: +4917077651234
> ^C

with --anonymize

130 mark@kramidnarg:~/telegram_backup_debugging⟫ java -jar telegram_backup.jar --anonymize
Telegram_Backup version 1.1.0, Copyright (C) 2016, 2017 Fabian Schlenz

Telegram_Backup comes with ABSOLUTELY NO WARRANTY. This is free software, and you are
welcome to redistribute it under certain conditions; run it with '--license' for details.

Base directory for files: /aaaa/aaaa/.aaaaaaaa_aaaaaa (ANONYMIZED)
No accounts found. Starting login process...
Exception in thread "main" java.lang.NullPointerException
        at de.fabianonline.telegram_backup.Utils.anonymize(Utils.java:175)
        at de.fabianonline.telegram_backup.CommandLineController.selectAccount(CommandLineController.java:223)
        at de.fabianonline.telegram_backup.CommandLineController.<init>(CommandLineController.java:68)
        at de.fabianonline.telegram_backup.CommandLineRunner.main(CommandLineRunner.java:41)
fabianonline commented 6 years ago

"Accidentally" fixed while converting to Kotlin.