mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
Prevent crash when switching to fixed with in assistant
The problem was initially the user doesn't have any column offsets defined which the tokenize function wasn't handling properly
This commit is contained in:
parent
da0120d533
commit
bce5eaaa1d
@ -174,6 +174,11 @@ void GncFwTokenizer::load_file(const std::string& path)
|
||||
|
||||
line.clear();
|
||||
}
|
||||
|
||||
/* Set a sane default for the offsets
|
||||
* That is, assume one column with all the data */
|
||||
if (m_col_vec.empty())
|
||||
m_col_vec.push_back(m_longest_line);
|
||||
}
|
||||
|
||||
|
||||
|
@ -75,7 +75,7 @@ public:
|
||||
std::string cols_to_string();
|
||||
void cols_from_string(const std::string& col_str);
|
||||
|
||||
void load_file (const std::string& path);
|
||||
void load_file (const std::string& path) override;
|
||||
int tokenize() override;
|
||||
|
||||
|
||||
|
@ -88,12 +88,6 @@ GncTokenizer::encoding()
|
||||
}
|
||||
|
||||
|
||||
int GncTokenizer::tokenize()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
const std::vector<str_vec>&
|
||||
GncTokenizer::get_tokens()
|
||||
{
|
||||
|
@ -67,11 +67,11 @@ public:
|
||||
GncTokenizer& operator=(GncTokenizer&&) = default; // move assignment
|
||||
virtual ~GncTokenizer() = default; // destructor
|
||||
|
||||
void load_file(const std::string& path);
|
||||
virtual void load_file(const std::string& path);
|
||||
const std::string& current_file();
|
||||
void encoding(const std::string& encoding);
|
||||
const std::string& encoding();
|
||||
virtual int tokenize();
|
||||
virtual int tokenize() = 0;
|
||||
const std::vector<str_vec>& get_tokens();
|
||||
|
||||
protected:
|
||||
|
Loading…
Reference in New Issue
Block a user