From fc80fd1f6e67ceb0117ac4d69470ce7a52c163bf Mon Sep 17 00:00:00 2001 From: ilor <kailoran@gmail.com> Date: Wed, 20 Oct 2010 13:14:18 +0200 Subject: [PATCH] fix Tagset::get_pos_mask with an invalid idx --- libcorpus2/tagset.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/libcorpus2/tagset.cpp b/libcorpus2/tagset.cpp index 82dfd31..51bce4a 100644 --- a/libcorpus2/tagset.cpp +++ b/libcorpus2/tagset.cpp @@ -354,7 +354,11 @@ mask_t Tagset::get_pos_mask(const string_range& pos) const mask_t Tagset::get_pos_mask(idx_t pos) const { - return 1 << pos; + if (pos >= 0) { + return 1 << pos; + } else { + return 0; + } } idx_t Tagset::get_attribute_index(const string_range& a) const -- GitLab