From 357569eea8f4e3a0f56e1df185d3c6a6d6a66bcd Mon Sep 17 00:00:00 2001 From: Suresh Manikonda Date: Wed, 10 Jun 2026 11:41:34 -0400 Subject: [PATCH] Handle empty response from API listNetworkOfferings MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fix unhandled error when the response from API listNetworkOfferings is empty and causing TypeError on JS code. This is to prevent a crash and showing pop up error window — If the API returns a response where listnetworkofferingsresponse has no networkoffering key (which happens when there are zero results — CloudStack omits empty arrays in JSON responses), the value would be undefined. The next line calls .filter() on it, which would throw TypeError: Cannot read properties of undefined (reading 'filter'). --- ui/src/views/network/CreateIsolatedNetworkForm.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ui/src/views/network/CreateIsolatedNetworkForm.vue b/ui/src/views/network/CreateIsolatedNetworkForm.vue index bf415f7b68d4..53312d0c4024 100644 --- a/ui/src/views/network/CreateIsolatedNetworkForm.vue +++ b/ui/src/views/network/CreateIsolatedNetworkForm.vue @@ -551,7 +551,7 @@ export default { this.networkOfferings = [] this.selectedNetworkOffering = {} getAPI('listNetworkOfferings', params).then(json => { - this.networkOfferings = json.listnetworkofferingsresponse.networkoffering + this.networkOfferings = json.listnetworkofferingsresponse.networkoffering || [] this.networkOfferings = this.networkOfferings.filter(offering => offering.fornsx === this.selectedZone.isnsxenabled) if (!this.selectedZone.routedmodeenabled) { this.networkOfferings = this.networkOfferings.filter(offering => offering.networkmode !== 'ROUTED')