Roger,

Thanks for the error checking tips, but that doesn't address the real
problem - why might this code address some illegal memory space? Are you
suggesting that maybe one of these pointers or handles is NULL, and that's
the problem?

BTW, I'm not really hardcoding the ID's - that was just to make the code
snippet a little easier.

Thanks,

Brian Smith

> -----Original Message-----
> From: Stringer [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, May 08, 2001 7:35 AM
> To: Palm Developer Forum
> Subject: "bus error"
> 
> 
> >From: Brian Smith <[EMAIL PROTECTED]>
> >Date: Tue, 8 May 2001 01:00:46 -0400
> >
> >I get the following error from the Emulator, right when my 
> app starts, I
> >think when it tries to assign a value to the data field of a gadget:
> 
> >"{programName} just read from  memory location 0x01C70C68, 
> >causing a bus error."
> >
> >..........
> >
> At a minimum, you need to add some basic error checking to your
> code, as follows:
> 
> void MainFormsDrawItems(FormPtr pForm) {
> 
>         if (pForm == NULL) return;
>    RectangleType rect;
>    UInt16 nGadgetID = 1061;  //  Hardcoding of ID's is poor style!
>    UInt16 nGadgetIndex; 
>    UInt8 *pItemNum;
>    MemHandle hItemData = NULL;
>    
>    nGadgetIndex = FrmGetObjectIndex(pForm, nGadgetID);
>    if (nGadgetIndex != NULL)
>         hItemData = FrmGetGadgetData(pForm, nGadgetIndex);
>  
>    ///if (hItemData) {
>         if (hItemData == NULL) return;
> 
>       pItemNum = MemHandleLock(hItemData);
> 
> 
> 
> Roger Stringer
> Marietta Systems, Inc.
> 
> 
> -- 
> For information on using the Palm Developer Forums, or to 
> unsubscribe, please see http://www.palmos.com/dev/tech/support/forums/
> 

-- 
For information on using the Palm Developer Forums, or to unsubscribe, please see 
http://www.palmos.com/dev/tech/support/forums/

Reply via email to