Commit 0b2a8cce authored by Ludovic Hussonnois's avatar Ludovic Hussonnois

BUG: Correct access to empty vector of class field index in unsupervised

parent 8b0994d5
......@@ -65,7 +65,7 @@ protected:
{
m_FeaturesInfo.SetClassFieldNames( GetChoiceNames( "cfield" ), GetSelectedItems( "cfield" ) );
if( m_FeaturesInfo.m_SelectedCFieldIdx.empty() )
if( m_FeaturesInfo.m_SelectedCFieldIdx.empty() && GetClassifierCategory() == Supervised )
{
otbAppLogFATAL( << "No field has been selected for data labelling!" );
}
......
......@@ -125,7 +125,7 @@ protected:
{
m_SelectedCFieldIdx = selectedCFieldIdx;
// Handle only one class field name, if several are provided only the first one is used.
m_SelectedCFieldName = cFieldNames[selectedCFieldIdx.front()];
m_SelectedCFieldName = selectedCFieldIdx.empty() ? cFieldNames.front() : cFieldNames[selectedCFieldIdx.front()];
}
};
......
Markdown is supported
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