Skip to content

Commit

Permalink
Refs #4333. Fix a possible crash in DataItem upcasting.
Browse files Browse the repository at this point in the history
  • Loading branch information
martyngigg committed Dec 19, 2011
1 parent dc4ac84 commit a3cb44a
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -79,12 +79,13 @@ namespace Mantid
{
if( PyObject_IsSubclass((PyObject*)it->first, valueType) )
{
if( !result && it->second->isInstance(value) ) // First one
if( !result && it->second->isInstance(value) )
{
result = it->first;
}
// Check if this match is further up the chain than the last
else if(PyObject_IsSubclass((PyObject*)it->first, (PyObject*)result) && it->second->isInstance(value) )
if( result && PyObject_IsSubclass((PyObject*)it->first, (PyObject*)result)
&& it->second->isInstance(value) )
{
result = it->first;
}
Expand Down

0 comments on commit a3cb44a

Please sign in to comment.