1
0
mirror of https://github.com/fabianonline/telegram_backup.git synced 2024-12-25 22:35:35 +00:00

Changed the order of code in CommandLineController to allow login when no database is present yet. Duh.

This commit is contained in:
Fabian Schlenz 2017-12-06 06:09:45 +01:00
parent 5328df65b3
commit 9693371a3d

View File

@ -79,8 +79,7 @@ public class CommandLineController {
try {
logger.info("Initializing UserManager");
UserManager.init(client);
Database.init(client);
UserManager user = UserManager.getInstance();
if (!CommandLineOptions.cmd_login && !user.isLoggedIn()) {
@ -93,7 +92,19 @@ public class CommandLineController {
throw new RuntimeException("Account / User mismatch");
}
}
logger.debug("CommandLineOptions.cmd_login: {}", CommandLineOptions.cmd_login);
if (CommandLineOptions.cmd_login) {
cmd_login(account);
System.exit(0);
}
// If we reach this point, we can assume that there is an account and a database can be loaded / created.
Database.init(client);
if (CommandLineOptions.cmd_stats) {
cmd_stats();
System.exit(0);
@ -120,11 +131,7 @@ public class CommandLineController {
}
}
logger.debug("CommandLineOptions.cmd_login: {}", CommandLineOptions.cmd_login);
if (CommandLineOptions.cmd_login) {
cmd_login(account);
System.exit(0);
}
if (user.isLoggedIn()) {
System.out.println("You are logged in as " + Utils.anonymize(user.getUserString()));