Mantis - Squeak
Viewing Issue Advanced Details
7299 System minor always 02-23-09 21:14 02-23-09 22:49
acknowledged 3.10.2  
0007299: Problem encountered in reading help files
Following the menu path "World | Help | Preferences | Help!" causes an index error exception. This is because one of the help strings is empty, and Preferences>>giveHelpWithPreferences invokes SequenceableCollections>>last on the empty string. The "last" method is implemented as "^self at: self size", causing the index error when size is zero.
 giveHelpWithPreferences-jlh-M7299.1.cs.gz [^] (1,425 bytes) 02-23-09 22:36

02-23-09 21:26   
I can verify the error exists in 3.10.2-7179
02-23-09 21:53   
This particular preference is rendered as a set of radio buttons and not as a checkbox, as a result through the UI there is no access to help for the overall preference. As such it was logical not to provide help since it is provided for each of the choices. But this breaks the help text generator which assumes that every preference has non-empty help.

So the question is who is in the wrong?

1. An empty help string is not a valid choice.

2. Assuming the help string is not empty is invalid.

I've confirmed that the help strings from the individual choices are not used in generating the help text which is also a deficiency.
02-23-09 22:49   
I have submitted a fix in which I edited Preferences>>giveHelpWithPreferences to not call the "last" method on aHelpString if aHelpString is empty. It seemed appropriate that the fix NOT be made in SequenceableCollection>>last, as the only reasonable fix there would be to return something other than the last element of the sequence (e.g., ^self). Since this could lead to the caller having to check the return for appropriateness, it seems better to just leave "last" alone and make the caller responsible for valid parameters.