summaryrefslogtreecommitdiff
path: root/core/src/fxge/dib/fx_dib_main.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'core/src/fxge/dib/fx_dib_main.cpp')
-rw-r--r--core/src/fxge/dib/fx_dib_main.cpp15
1 files changed, 12 insertions, 3 deletions
diff --git a/core/src/fxge/dib/fx_dib_main.cpp b/core/src/fxge/dib/fx_dib_main.cpp
index f55b2f5737..a54c9abed0 100644
--- a/core/src/fxge/dib/fx_dib_main.cpp
+++ b/core/src/fxge/dib/fx_dib_main.cpp
@@ -85,12 +85,12 @@ FX_BOOL CFX_DIBitmap::Create(int width, int height, FXDIB_Format format, FX_LPBY
int oomlimit = _MAX_OOM_LIMIT_;
if (oomlimit >= 0 && size >= oomlimit) {
m_pBuffer = FX_TryAlloc(FX_BYTE, size);
- if (m_pBuffer == NULL) {
- return FALSE;
- }
} else {
m_pBuffer = FX_Alloc(FX_BYTE, size);
}
+ if (m_pBuffer == NULL) {
+ return FALSE;
+ }
}
m_Width = width;
m_Height = height;
@@ -202,6 +202,9 @@ void CFX_DIBSource::BuildPalette()
}
if (GetBPP() == 1) {
m_pPalette = FX_Alloc(FX_DWORD, 2);
+ if (!m_pPalette) {
+ return;
+ }
if(IsCmykImage()) {
m_pPalette[0] = 0xff;
m_pPalette[1] = 0;
@@ -211,6 +214,9 @@ void CFX_DIBSource::BuildPalette()
}
} else if (GetBPP() == 8) {
m_pPalette = FX_Alloc(FX_DWORD, 256);
+ if (!m_pPalette) {
+ return;
+ }
if(IsCmykImage()) {
for (int i = 0; i < 256; i ++) {
m_pPalette[i] = 0xff - i;
@@ -525,6 +531,9 @@ void CFX_DIBSource::CopyPalette(const FX_DWORD* pSrc, FX_DWORD size)
if (m_pPalette == NULL) {
m_pPalette = FX_Alloc(FX_DWORD, pal_size);
}
+ if (!m_pPalette) {
+ return;
+ }
if (pal_size > size) {
pal_size = size;
}