Skip to content

Commit

Permalink
WordFontAttributes: Check that word != nullptr earlier. Fix #1665
Browse files Browse the repository at this point in the history
  • Loading branch information
amitdo committed Jun 13, 2018
1 parent 8b64602 commit 6f85de2
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/ccmain/ltrresultiterator.cpp
Expand Up @@ -166,13 +166,13 @@ const char* LTRResultIterator::WordFontAttributes(bool* is_bold,
bool* is_smallcaps,
int* pointsize,
int* font_id) const {
if (it_->word() == nullptr) return nullptr; // Already at the end!
float row_height = it_->row()->row->x_height() +
it_->row()->row->ascenders() - it_->row()->row->descenders();
// Convert from pixels to printers points.
*pointsize = scaled_yres_ > 0
? static_cast<int>(row_height * kPointsPerInch / scaled_yres_ + 0.5)
: 0;
if (it_->word() == nullptr) return nullptr; // Already at the end!
if (it_->word()->fontinfo == nullptr) {
*font_id = -1;
return nullptr; // No font information.
Expand Down

0 comments on commit 6f85de2

Please sign in to comment.