From 2b976f58ba64e5dfaf0c89f19474c546afd99635 Mon Sep 17 00:00:00 2001 From: M M Arif Date: Tue, 17 Mar 2020 15:36:26 +0500 Subject: [PATCH] Check if data really exists --- .../org/mian/gitnex/activities/CreateRepoActivity.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) 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); }