[comp.sys.mac.hypercard] MacTutor Popup menu bug fix

stone@hydra.unm.edu (Andrew Stone CS.DEPT) (01/31/89)

In January's MacTutor, Fred Stauder, on page 68-69 presents a very nice
hypertalk pop-up menu. It needs one extra line of code to be thoroughly
robust: the last expression of the following line of code can sometimes 
return -1, and then totally confuse the interpretator:

  select char offset(line sel of me,me) to (offset(line sel+1 of me,me) of me

When choosing the second to last item in the list, the script can crash and 
produce the following error message: 'Expected unsigned integer but found "(".'

To "head off the bug" simply insert this test before that line:

if  (offset(line sel + 1 of me ,me)-1) <0 then next repeat

Thanks, Fred, for the fine ideas!  Are you on this net, or does anyone have a 
path to him?

andrew

||<<++>>||<<-->>||<<==>>||<<++>>||<<??>>||<<++>>||<<-->>||<<==>>||<<++>>||
||                                  ||                                  ||
||	   Andrew Stone	            ??		2 + 2 = 5;		|| 
||         stone@hydra.unm.edu	    <> 	    for sufficiently large 2    ||
||	   			    ||					||
||<<++>>||<<-->>||<<==>>||<<++>>||<<??>>||<<++>>||<<-->>||<<==>>||<<++>>||