Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
ACGL
acgl
Commits
23830adb
Commit
23830adb
authored
Feb 14, 2013
by
Robert Menzel
Browse files
don't dereference a NULL pointer...
parent
ac88dd23
Changes
2
Hide whitespace changes
Inline
Side-by-side
include/ACGL/OpenGL/Objects/Buffer.hh
View file @
23830adb
...
...
@@ -106,7 +106,7 @@ public:
:
mBuffer
(
_pBuffer
),
mTarget
(
_target
)
{
mSize
=
mBuffer
->
getSize
(
_t
arget
);
mSize
=
(
mBuffer
==
NULL
)
?
0
:
mBuffer
->
getSize
(
mT
arget
);
}
virtual
~
Buffer
(){}
...
...
@@ -124,7 +124,7 @@ public:
// ==================================================================================================== \/
//! the GL buffer can get changed at any time
void
setBufferObject
(
SharedBufferObject
_pBuffer
)
{
mBuffer
=
_pBuffer
;
mSize
=
mBuffer
->
getSize
(
mTarget
);
}
void
setBufferObject
(
SharedBufferObject
_pBuffer
)
{
mBuffer
=
_pBuffer
;
mSize
=
(
mBuffer
==
NULL
)
?
0
:
mBuffer
->
getSize
(
mTarget
);
}
// ===================================================================================================== \/
// ============================================================================================ WRAPPERS \/
...
...
include/ACGL/OpenGL/Objects/TextureBuffer.hh
View file @
23830adb
...
...
@@ -92,11 +92,15 @@ private:
void
bind
()
{}
void
attachBufferToTexture
()
{
assert
(
Buffer
::
getSize
()
>
0
&&
"glTexBuffer will fail if the buffer is empty"
);
bindTexture
();
openGLCriticalErrorOccured
();
glTexBuffer
(
GL_TEXTURE_BUFFER
,
mDataType
,
Buffer
::
getObjectName
()
);
if
(
mBuffer
==
NULL
)
{
// the buffer was in fact detached
bindTexture
();
glTexBuffer
(
GL_TEXTURE_BUFFER
,
mDataType
,
0
);
}
else
{
assert
(
Buffer
::
getSize
()
>
0
&&
"glTexBuffer will fail if the buffer is empty"
);
bindTexture
();
glTexBuffer
(
GL_TEXTURE_BUFFER
,
mDataType
,
Buffer
::
getObjectName
()
);
}
openGLCriticalErrorOccured
();
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment