# conversion problem

## Recommended Posts

majak    122
I can build my project, but get this error when compiling: First-chance exception at 0x100033a8 in CreateTexture.exe: 0xC0000005: Access violation writing location 0xcdcdcdcd. An unhandled exception of type 'System.NullReferenceException' occurred in CreateTexture.exe Additional information: Object reference not set to an instance of an object. This is why:
int size = nbPixels;
PUCHAR *pixelBuffer = new PUCHAR[size];
int var = retrieveAndRender(*pixelBuffer, the_Device);


How do I fix that? The function I'm calling is: OCT_API int retrieveAndRender(PUCHAR picRef, unsigned long adr); I don't know what an PUCHAR is, so I don't know what else to do.

##### Share on other sites
jollyjeffers    1570
The hex code, 0xCDCDCDCD you mention is one of the special codes that the debug runtime will fill parts of RAM with to make debugging easier [smile]

This line seems to be passing in the value of the pointer - that is the actual address if I'm not mistaken.

int var = retrieveAndRender(*pixelBuffer, the_Device);

Removing the "*" and making it:

int var = retrieveAndRender(pixelBuffer, the_Device);

Should work [smile]

hth
Jack