Better safety around boost::optional.
I'm not sure these are necessary but I got a crash when checking one as a boolean instead of calling is_initialized(). Sadly, my debugger doesn't like boost, so I didn't get much more info.
This commit is contained in:
parent
eeae94b4b6
commit
29df4f809e
|
@ -185,13 +185,11 @@ bool TOOL_EVENT::IsDblClick( int aButtonMask ) const
|
|||
|
||||
bool TOOL_EVENT::IsCancelInteractive()
|
||||
{
|
||||
if( GetCommandStr() && GetCommandStr().get() == ACTIONS::cancelInteractive.GetName() )
|
||||
return true;
|
||||
|
||||
if( GetCommandId() && GetCommandId().get() == ACTIONS::cancelInteractive.GetId() )
|
||||
return true;
|
||||
|
||||
return IsCancel();
|
||||
return( ( m_commandStr.is_initialized()
|
||||
&& m_commandStr.get() == ACTIONS::cancelInteractive.GetName() )
|
||||
|| ( m_commandId.is_initialized()
|
||||
&& m_commandId.get() == ACTIONS::cancelInteractive.GetId() )
|
||||
|| ( m_actions == TA_CANCEL_TOOL ) );
|
||||
}
|
||||
|
||||
|
||||
|
@ -205,20 +203,15 @@ bool TOOL_EVENT::IsSelectionEvent()
|
|||
|
||||
bool TOOL_EVENT::IsPointEditor()
|
||||
{
|
||||
if( GetCommandStr() && GetCommandStr().get().find( "PointEditor" ) != GetCommandStr()->npos )
|
||||
return true;
|
||||
|
||||
if( GetCommandId() && GetCommandId() == ACTIONS::activatePointEditor.GetId() )
|
||||
return true;
|
||||
|
||||
return false;
|
||||
return( ( m_commandStr.is_initialized()
|
||||
&& m_commandStr.get().find( "PointEditor" ) != GetCommandStr()->npos )
|
||||
|| ( m_commandId.is_initialized()
|
||||
&& m_commandId.get() == ACTIONS::activatePointEditor.GetId() ) );
|
||||
}
|
||||
|
||||
|
||||
bool TOOL_EVENT::IsMoveTool()
|
||||
{
|
||||
if( GetCommandStr() && GetCommandStr().get().find( "InteractiveMove" ) != GetCommandStr()->npos )
|
||||
return true;
|
||||
|
||||
return false;
|
||||
return( m_commandStr.is_initialized()
|
||||
&& m_commandStr.get().find( "InteractiveMove" ) != GetCommandStr()->npos );
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue