diff --git a/app/src/main/java/org/mian/gitnex/activities/CreateRepoActivity.java b/app/src/main/java/org/mian/gitnex/activities/CreateRepoActivity.java index c56916d5..a7352cf8 100644 --- a/app/src/main/java/org/mian/gitnex/activities/CreateRepoActivity.java +++ b/app/src/main/java/org/mian/gitnex/activities/CreateRepoActivity.java @@ -251,8 +251,10 @@ public class CreateRepoActivity extends BaseActivity { if(organizationsList_.size() > 0) { for (int i = 0; i < organizationsList_.size(); i++) { - if(Integer.parseInt(tinyDb.getString("organizationId")) == organizationsList_.get(i).getId()) { - organizationId = i + 1; + if(!tinyDb.getString("organizationId").isEmpty()) { + if (Integer.parseInt(tinyDb.getString("organizationId")) == organizationsList_.get(i).getId()) { + organizationId = i + 1; + } } OrgOwner data = new OrgOwner( organizationsList_.get(i).getUsername() @@ -268,7 +270,7 @@ public class CreateRepoActivity extends BaseActivity { adapter.setDropDownViewResource(R.layout.spinner_dropdown_item); spinner.setAdapter(adapter); - if (tinyDb.getBoolean("organizationAction")) { + if (tinyDb.getBoolean("organizationAction") & organizationId != 0) { spinner.setSelection(organizationId); tinyDb.putBoolean("organizationAction", false); }