>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/

Reply via email to