Skip to content

Commit

Permalink
fix: Unable to add string when list is empty
Browse files Browse the repository at this point in the history
  • Loading branch information
ilyassesalama committed Oct 18, 2024
1 parent 480f767 commit 80e9e57
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions app/src/main/java/mod/bobur/StringEditorActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,11 @@ public void addString(final String key, final String text) {
HashMap<String, Object> map = new HashMap<>();
map.put("key", key);
map.put("text", text);
if (listmap.isEmpty()) {
listmap.add(map);
adapter.notifyItemInserted(0);
return;
}
for (int i = 0; i < listmap.size(); i++) {
if (Objects.equals(listmap.get(i).get("key"), key)) {
listmap.set(i, map);
Expand Down

0 comments on commit 80e9e57

Please sign in to comment.