Skip to content

Commit

Permalink
#773 Unnecessary count in ModelDelegate.findOrCreateIt()
Browse files Browse the repository at this point in the history
  • Loading branch information
ipolevoy committed Aug 25, 2018
1 parent d2f7a7a commit 3abf690
Showing 1 changed file with 4 additions and 2 deletions.
Expand Up @@ -454,8 +454,10 @@ public static <T extends Model> T findOrCreateIt(Class<T> clazz, boolean save, O
params[x++] = namesAndValues[i];
}
}
if(count(clazz, subQuery.toString(), params) > 0){
return findFirst(clazz, subQuery.toString(),params);

T instance = findFirst(clazz, subQuery.toString(),params);
if(instance != null){
return instance;
} else{

if(save){
Expand Down

0 comments on commit 3abf690

Please sign in to comment.