1
0
mirror of https://github.com/fabianonline/telegram_backup.git synced 2024-11-23 01:06:17 +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,7 +79,6 @@ public class CommandLineController {
try { try {
logger.info("Initializing UserManager"); logger.info("Initializing UserManager");
UserManager.init(client); UserManager.init(client);
Database.init(client);
UserManager user = UserManager.getInstance(); UserManager user = UserManager.getInstance();
@ -94,6 +93,18 @@ public class CommandLineController {
} }
} }
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) { if (CommandLineOptions.cmd_stats) {
cmd_stats(); cmd_stats();
System.exit(0); 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()) { if (user.isLoggedIn()) {
System.out.println("You are logged in as " + Utils.anonymize(user.getUserString())); System.out.println("You are logged in as " + Utils.anonymize(user.getUserString()));