From 4c52bfc394aae931ac67122de21cc3fa996dd0f4 Mon Sep 17 00:00:00 2001 From: "wei.ying" Date: Fri, 14 Apr 2017 18:29:44 +0800 Subject: [PATCH] Fix js error in resize instance form If an empty new flavor selected again, the disk will be undefined, we'll see the following in console.log. 1c302c01cae3.js:208 Uncaught TypeError: Cannot read property 'disk' of undefined Change-Id: Idd93a3f352386f85bfd947ad4c948bb3aa69e04e Closes-Bug: #1682788 --- openstack_dashboard/static/js/horizon.instances.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/openstack_dashboard/static/js/horizon.instances.js b/openstack_dashboard/static/js/horizon.instances.js index bc631e1a80..82ee94962b 100644 --- a/openstack_dashboard/static/js/horizon.instances.js +++ b/openstack_dashboard/static/js/horizon.instances.js @@ -88,7 +88,11 @@ horizon.addInitFunction(horizon.instances.init = function () { for selected image and flavor */ function update_device_size(source_type) { - var volume_size = horizon.Quota.getSelectedFlavor().disk; + var volume_size; + var selected_flavor = horizon.Quota.getSelectedFlavor(); + if (selected_flavor) { + volume_size = selected_flavor.disk; + } var size_field = $("#id_volume_size"); if (source_type === 'image') {