BADA: Prevent assertion failure when allocating zero bytes
This commit is contained in:
parent
bd028d4167
commit
3019b283f9
1 changed files with 4 additions and 2 deletions
|
@ -56,9 +56,11 @@ void Surface::create(uint16 width, uint16 height, const PixelFormat &f) {
|
||||||
format = f;
|
format = f;
|
||||||
pitch = w * format.bytesPerPixel;
|
pitch = w * format.bytesPerPixel;
|
||||||
|
|
||||||
|
if (width && height) {
|
||||||
pixels = calloc(width * height, format.bytesPerPixel);
|
pixels = calloc(width * height, format.bytesPerPixel);
|
||||||
assert(pixels);
|
assert(pixels);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void Surface::free() {
|
void Surface::free() {
|
||||||
::free(pixels);
|
::free(pixels);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue