From f5fc0de384a35d888918e1e80bb46b4ca3d0fbb8 Mon Sep 17 00:00:00 2001 From: "lpsolit%gmail.com" Date: Sun, 21 Aug 2005 20:05:39 +0000 Subject: [PATCH] Bug 290366: JavaScript error in productmenu.js from editflagtypes.cgi and request.cgi when only one product defined - Patch by Teemu Mannermaa r/a=myk git-svn-id: svn://10.0.0.236/trunk@178561 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/webtools/bugzilla/productmenu.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/mozilla/webtools/bugzilla/productmenu.js b/mozilla/webtools/bugzilla/productmenu.js index e633ab3279d..90bb18195df 100644 --- a/mozilla/webtools/bugzilla/productmenu.js +++ b/mozilla/webtools/bugzilla/productmenu.js @@ -181,6 +181,12 @@ function selectProduct( f , productfield, componentfield, blank ) { return; } + // Do nothing if no products are defined (this avoids the + // "a has no properties" error from merge_arrays function) + if (f[productfield].length == blank ? 1 : 0) { + return; + } + // if this is the first load and nothing is selected, no need to // merge and sort all components; perl gives it to us sorted. @@ -219,7 +225,8 @@ function selectProduct( f , productfield, componentfield, blank ) { for ( var i = blank ? 1 : 0 ; i < f[productfield].length ; i++ ) { sel[sel.length] = f[productfield].options[i].value; } - single = 0; + // If there is only one product, then only one product can be selected + single = ( sel.length == 1 ); } else { for ( i = blank ? 1 : 0 ; i < f[productfield].length ; i++ ) {