diff --git a/sakura_core/dlg/CDlgExec.cpp b/sakura_core/dlg/CDlgExec.cpp index c697dda619..54fa35e230 100644 --- a/sakura_core/dlg/CDlgExec.cpp +++ b/sakura_core/dlg/CDlgExec.cpp @@ -134,24 +134,29 @@ void CDlgExec::SetData( void ) /***************************** * データ設定 * *****************************/ - wcscpy( m_szCommand, m_pShareData->m_sHistory.m_aCommands[0] ); hwndCombo = GetItemHwnd( IDC_COMBO_m_szCommand ); Combo_ResetContent( hwndCombo ); - ::DlgItem_SetText( GetHwnd(), IDC_COMBO_TEXT, m_szCommand ); - int nSize = m_pShareData->m_sHistory.m_aCommands.size(); - for( i = 0; i < nSize; ++i ){ - Combo_AddString( hwndCombo, m_pShareData->m_sHistory.m_aCommands[i] ); + const int nCommandsCount = m_pShareData->m_sHistory.m_aCommands.size(); + if( 0 < nCommandsCount ){ + wcscpy( m_szCommand, m_pShareData->m_sHistory.m_aCommands[0] ); + ::DlgItem_SetText( GetHwnd(), IDC_COMBO_TEXT, m_szCommand ); + for( i = 0; i < nCommandsCount; ++i ){ + Combo_AddString( hwndCombo, m_pShareData->m_sHistory.m_aCommands[i] ); + } + Combo_SetCurSel( hwndCombo, 0 ); } - Combo_SetCurSel( hwndCombo, 0 ); - wcscpy( m_szCurDir, m_pShareData->m_sHistory.m_aCurDirs[0] ); hwndCombo = GetItemHwnd( IDC_COMBO_CUR_DIR ); Combo_ResetContent( hwndCombo ); - ::DlgItem_SetText( GetHwnd(), IDC_COMBO_TEXT, m_szCurDir ); - for( i = 0; i < m_pShareData->m_sHistory.m_aCurDirs.size(); ++i ){ - Combo_AddString( hwndCombo, m_pShareData->m_sHistory.m_aCurDirs[i] ); + const int nCurDirsCount = m_pShareData->m_sHistory.m_aCurDirs.size(); + if( 0 < nCurDirsCount ){ + wcscpy( m_szCurDir, m_pShareData->m_sHistory.m_aCurDirs[0] ); + ::DlgItem_SetText( GetHwnd(), IDC_COMBO_TEXT, m_szCurDir ); + for( i = 0; i < nCurDirsCount; ++i ){ + Combo_AddString( hwndCombo, m_pShareData->m_sHistory.m_aCurDirs[i] ); + } + Combo_SetCurSel( hwndCombo, 0 ); } - Combo_SetCurSel( hwndCombo, 0 ); int nOpt; hwndCombo = GetItemHwnd( IDC_COMBO_CODE_GET );