Commit 5c8e1be8 authored by Jan Möbius's avatar Jan Möbius
Browse files

Next patch to try to fix drawmode accessing uninitialized memory.



git-svn-id: http://www.openflipper.org/svnrepo/OpenFlipper/branches/Free@15703 383ad7c9-94d9-4d36-a494-682f7c89f535
parent e0fbfe7b
......@@ -226,8 +226,15 @@ bool DrawMode::propertyBased() const {
*/
void DrawMode::setDrawModeProperties(const DrawModeProperties* _props) {
if (!layers_.empty() && _props)
if (_props)
{
if (layers_.empty())
layers_.push_back(*_props);
else
layers_[0] = *_props;
}
else
layers_.erase(layers_.begin());
}
void DrawMode::setDrawModeProperties( const DrawModeProperties& _props )
......@@ -499,13 +506,13 @@ const DrawModeProperties* DrawMode::getLayer( unsigned int i ) const {
void DrawMode::addLayer( const DrawModeProperties* _props )
{
if (getLayerIndex(_props) < 0)
if (getLayerIndex(_props) < 0 && _props)
layers_.push_back(*_props);
}
bool DrawMode::removeLayer( unsigned int _i )
{
if (_i < layers_.size())
if (_i < layers_.size() && _i >= 0)
{
layers_.erase(layers_.begin() + _i);
return true;
......@@ -536,6 +543,8 @@ bool DrawMode::checkConsistency() const
int DrawMode::getLayerIndex( const DrawModeProperties* _prop ) const
{
if (!_prop) return -1;
for (unsigned int i = 0; i < layers_.size(); ++i)
{
if (!memcmp(&layers_[i], _prop, sizeof(DrawModeProperties)))
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment