mProfileListAdapter.setProfileList(newList);
createShortcuts(newList);
+
+ Profile currentProfile = Data.getProfile();
+ if (currentProfile == null || !newList.contains(currentProfile)) {
+ Logger.debug(TAG, "Switching profile because the current is no longer available");
+ Data.setCurrentProfile(newList.get(0));
+ }
}
/**
* called when the current profile has changed
b.transactionProgressLayout.setVisibility(View.GONE);
}
}
- public void onRetrieveProgress(RetrieveTransactionsTask.Progress progress) {
- if (progress.getState() == RetrieveTransactionsTask.ProgressState.FINISHED) {
+ public void onRetrieveProgress(@Nullable RetrieveTransactionsTask.Progress progress) {
+ if (progress == null ||
+ progress.getState() == RetrieveTransactionsTask.ProgressState.FINISHED)
+ {
Logger.debug("progress", "Done");
b.transactionProgressLayout.setVisibility(View.GONE);
mainModel.transactionRetrievalDone();
- String error = progress.getError();
+ String error = (progress == null) ? null : progress.getError();
if (error != null) {
if (error.equals(RetrieveTransactionsTask.Result.ERR_JSON_PARSER_ERROR))
error = getResources().getString(R.string.err_json_parser_error);