2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-04-28 03:26:45 +00:00

Check length before access (#7923)

This commit is contained in:
Oliver 2024-08-19 17:12:12 +10:00 committed by GitHub
parent 453dac6d00
commit 6572e64144
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -432,7 +432,11 @@ export default function PartDetail() {
.then((response) => { .then((response) => {
switch (response.status) { switch (response.status) {
case 200: case 200:
return response.data[response.data.length - 1]; if (response.data.length > 0) {
return response.data[response.data.length - 1];
} else {
return null;
}
default: default:
return null; return null;
} }