Skip to content

A continuation of HomeBox the inventory and organization system built for the Home User

ProductBarcode: properly check array boundaries

Crumb Owl7129650efad7
diff --git a/frontend/components/Item/BarcodeModal.vue b/frontend/components/Item/BarcodeModal.vue
index f2deee7f..006270f8 100644
--- a/frontend/components/Item/BarcodeModal.vue
+++ b/frontend/components/Item/BarcodeModal.vue
@@ -173,7 +173,12 @@
const api = useUserApi();
function createItem() {
- if (products !== null) {
+ if (
+ products.value !== null &&
+ products.value.length > 0 &&
+ selectedRow.value >= 0 &&
+ selectedRow.value < products.value.length
+ ) {
const p = products.value![selectedRow.value];
openDialog(DialogID.CreateItem, { product: p });
}