mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
Csv Importer - Prevent crash if number of saved columns is higher than actually detected ones.
I ran into this while trying to load a utf-16 encoded file and loading a saved preset using utf-8. By applying the preset the columns in the utf-16 file were no longer detected, but the importer was still trying to read from a preset account column.
This commit is contained in:
parent
6ee1c71d50
commit
79dd7d69d0
@ -907,9 +907,13 @@ GncTxImport::accounts ()
|
||||
continue;
|
||||
|
||||
auto col_strs = std::get<PL_INPUT>(parsed_line);
|
||||
if ((acct_col_it != m_settings.m_column_types.end()) && !col_strs[acct_col].empty())
|
||||
if ((acct_col_it != m_settings.m_column_types.end()) &&
|
||||
(acct_col < col_strs.size()) &&
|
||||
!col_strs[acct_col].empty())
|
||||
accts.insert(col_strs[acct_col]);
|
||||
if ((tacct_col_it != m_settings.m_column_types.end()) && !col_strs[tacct_col].empty())
|
||||
if ((tacct_col_it != m_settings.m_column_types.end()) &&
|
||||
(tacct_col < col_strs.size()) &&
|
||||
!col_strs[tacct_col].empty())
|
||||
accts.insert(col_strs[tacct_col]);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user