diff --git a/libcorpus2/io/iob-chan.cpp b/libcorpus2/io/iob-chan.cpp index dd07211fc94d3ef0456ef22d020514c08eb033c2..c7b3ab4884a9cb88753e95a7570ef6c70d1b1a8d 100644 --- a/libcorpus2/io/iob-chan.cpp +++ b/libcorpus2/io/iob-chan.cpp @@ -60,7 +60,7 @@ void IobChanWriter::write_token(const Token& t) void IobChanWriter::write_sentence(const Sentence& s) { const AnnotatedSentence* ann = dynamic_cast<const AnnotatedSentence*>(&s); - if (force_) { + if (ann && force_) { // I sincerely apologize AnnotatedSentence* hax = const_cast<AnnotatedSentence*>(ann); foreach(const AnnotatedSentence::chan_map_t::value_type& v, hax->all_channels()) {