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:
Geert Janssens 2016-09-15 14:26:35 +02:00 committed by Geert Janssens
parent da0120d533
commit bce5eaaa1d
4 changed files with 8 additions and 9 deletions

View File

@ -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);
}

View File

@ -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;

View File

@ -88,12 +88,6 @@ GncTokenizer::encoding()
}
int GncTokenizer::tokenize()
{
return 0;
}
const std::vector<str_vec>&
GncTokenizer::get_tokens()
{

View File

@ -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: