it would be strange to happen, because the config should always have
a current profile, but who knows… defensive programming
restoreProfiles(profiles);
restoreTemplates(templates);
- if (Data.getProfile() == null && currentProfile != null) {
- Profile p = DB.get()
- .getProfileDAO()
- .getByUuidSync(currentProfile);
+ if (Data.getProfile() == null) {
+ Profile p = null;
+ final ProfileDAO dao = DB.get()
+ .getProfileDAO();
+ if (currentProfile != null)
+ p = dao.getByUuidSync(currentProfile);
+
+ if (p == null)
+ dao.getAnySync();
+
if (p != null)
Data.postCurrentProfile(p);
}