prevent null pointer access crashes/memory trashing.
[AROS.git] / rom / oop / getattr.c
blob76620d8d4f7370afde5b867b6aaa6efe4d1d0f08
1 /*
2 Copyright © 1995-2007, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc: Get an attribute of an object.
6 Lang: english
7 */
8 #include <exec/lists.h>
9 #include <proto/exec.h>
10 #include "intern.h"
11 #include <aros/debug.h>
12 #include <oop/static_mid.h>
14 /*****************************************************************************
16 NAME */
17 #include <proto/oop.h>
19 AROS_LH3(IPTR, OOP_GetAttr,
21 /* SYNOPSIS */
22 AROS_LHA(OOP_Object *, object, A0),
23 AROS_LHA(OOP_AttrID , attrID, A1),
24 AROS_LHA(IPTR *, storage, A2),
26 /* LOCATION */
27 struct Library *, OOPBase, 16, OOP)
29 /* FUNCTION
30 Gets the specifed attribute from the object,
31 and puts it into storage.
33 INPUTS
34 object - pointer to object from which we want to
35 get an attribute.
37 attrID - Attribute ID for property to get.
39 storage - Pointer to IPTR the gitten data should be put
40 into.
43 RESULT
44 Undefined.
46 NOTES
48 EXAMPLE
50 BUGS
52 SEE ALSO
53 OOP_SetAttrs()
55 INTERNALS
57 HISTORY
58 29-10-95 digulla automatically created from
59 intuition_lib.fd and clib/intuition_protos.h
61 *****************************************************************************/
63 AROS_LIBFUNC_INIT
65 struct pRoot_Get p;
66 struct IntOOPBase *iOOPBase = (struct IntOOPBase *)OOPBase;
68 EnterFunc(bug("OOP_GetAttr())\n"));
70 if (!iOOPBase->ob_mRoot_Get)
71 iOOPBase->ob_mRoot_Get = OOP_GetMethodID(IID_Root, moRoot_Get);
74 p.mID = iOOPBase->ob_mRoot_Get;
75 p.attrID = attrID;
76 p.storage = storage;
78 /* Call the Get() method on the object */
80 ReturnPtr ("OOP_GetAttr", IPTR, OOP_DoMethod(object, (OOP_Msg)&p));
82 AROS_LIBFUNC_EXIT
83 } /* OOP_GetAttr */