Skip to content

Commit 8c0dd85

Browse files
Bug fix
MeltDown button sets the count to negative when pressed below 0.(no more negative values)
1 parent 1d626ad commit 8c0dd85

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

app/src/main/java/com/geeks4ever/counter_app/viewmodel/CounterViewModel.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,10 @@ public void IncrementCount(){
4343

4444
public int DecrementCount(){
4545
int countint = Integer.parseInt(Objects.requireNonNull(count.getValue()));
46-
countint--;
47-
countRepository.setCount(countint);
46+
if (countint > 0){
47+
countint--;
48+
countRepository.setCount(countint);
49+
}
4850
return countint;
4951
}
5052

0 commit comments

Comments
 (0)