Skip to content

Commit 768a973

Browse files
committed
Fixed getGroup considering subclasses
1 parent 00437d0 commit 768a973

File tree

3 files changed

+5
-3
lines changed

3 files changed

+5
-3
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ All notable changes to this project will be documented in this file.
66
### Fixed
77
- Fixed payment status screen not updating when in a stopped activity
88
- Fixed scanner shopping cart button not updating when in a stopped activity
9+
- Fixed barcode search crashing when multiple templates were matching on a single product with the same input
910

1011
## [0.13.16]
1112

core/src/main/java/io/snabble/sdk/codes/templates/CodeTemplate.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -224,9 +224,10 @@ public List<Group> getGroups() {
224224

225225
public <T extends Group> T getGroup(Class<? extends Group> clazz) {
226226
for (Group group : groups) {
227-
if (group.getClass() == clazz) {
227+
try {
228+
group.getClass().asSubclass(clazz);
228229
return (T) group;
229-
}
230+
} catch (ClassCastException ignored) { }
230231
}
231232

232233
return null;

ui/src/main/java/io/snabble/sdk/ui/search/SearchableProductAdapter.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ public void onBindViewHolder(final RecyclerView.ViewHolder viewHolder, final int
138138
.buildCode();
139139

140140
if (finalCode == null) {
141-
Logger.d("wtf");
141+
return;
142142
}
143143

144144
holder.itemView.setOnClickListener(new View.OnClickListener() {

0 commit comments

Comments
 (0)