Skip to content
Snippets Groups Projects
Commit 925af5c9 authored by ilor's avatar ilor
Browse files

fix SentenceContext::at(int) UB due to wrong check being done

parent e0ba6fc9
No related merge requests found
...@@ -75,7 +75,7 @@ public: ...@@ -75,7 +75,7 @@ public:
/// Token access convenience function - const. /// Token access convenience function - const.
/// Will return NULL if the passed position is not valid in this Sentence /// Will return NULL if the passed position is not valid in this Sentence
const Corpus2::Token* at(int abs_pos) const { const Corpus2::Token* at(int abs_pos) const {
if (is_current_inside()) { if (is_inside(abs_pos)) {
return get_sentence()[abs_pos]; return get_sentence()[abs_pos];
} else { } else {
return NULL; return NULL;
...@@ -90,7 +90,7 @@ public: ...@@ -90,7 +90,7 @@ public:
/// Token access convenience function. /// Token access convenience function.
/// Will return NULL if the passed position is not valid in this Sentence /// Will return NULL if the passed position is not valid in this Sentence
Corpus2::Token* at(int abs_pos) { Corpus2::Token* at(int abs_pos) {
if (is_current_inside()) { if (is_inside(abs_pos)) {
return get_sentence()[abs_pos]; return get_sentence()[abs_pos];
} else { } else {
return NULL; return NULL;
......
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