Not sure if I understand. Is this a request to change something? I'm not too familiar with this portion of the API, and not sure how this might affect other code, but see my proposed changes below (expanded for ease of readability).
The line 99: if(typeof(index)=='number') return {text:o[index].text,value:o[index].value}; Is proposed to be changed to something like this? 96 | p.getItem = function( index ) 97 | { 98 | if ( this.getElm() ) 99 | { 100 | var o = this.elm.options; 101 | 102 | if ( typeof( index ) == 'number' && ( index >= 0 || index < o.length) 103 | { 104 | return { text:o[index].text, value:o[index].value }; 105 | } 106 | else if ( typeof( index ) == 'undefined' ) 107 | { 108 | return( null ); 109 | } 110 | else 111 | { 112 | for( var i = 0; i < o.length; i++ ) 113 | { 114 | if ( index == o[i].value ) 115 | { 116 | return { text:o[i].text, value:o[i].value }; 117 | } 118 | } 119 | } 120 | } 121 | }; Leif ----- Original Message ----- From: <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Friday, September 05, 2003 12:22 AM Subject: [Dynapi-Dev] Index out of bound in htmltextbox getItem > > What is the correct thing to do here? > > The simple thing would be to return null if o[index] is not a valid > option. > > Test choices: > if index < 0 || index >= o.length > o[index] === undefined > > > > Error: o[index] has no properties > Source File: dynapi3x/src/gui/htmllistbox.js > Line: 99 > > 96 p.getItem = function(index){ > 97 if(this.getElm()) { > 98 var o = this.elm.options; > 99 if(typeof(index)=='number') return {text:o[index].text,value:o[index].value}; > else { > for(var i=0;i<o.length;i++) if(index==o[i].value) return { > text:o[i].text, > value:o[i].value > } > } > } > }; > > > ------------------------------------------------------- > This sf.net email is sponsored by:ThinkGeek > Welcome to geek heaven. > http://thinkgeek.com/sf > _______________________________________________ > Dynapi-Dev mailing list > [EMAIL PROTECTED] > http://www.mail-archive.com/[EMAIL PROTECTED]/ > > ------------------------------------------------------- This sf.net email is sponsored by:ThinkGeek Welcome to geek heaven. http://thinkgeek.com/sf _______________________________________________ Dynapi-Dev mailing list [EMAIL PROTECTED] http://www.mail-archive.com/[EMAIL PROTECTED]/