Skip to content

Commit

Permalink
Restore a null pointer check I missed in the latest refactor.
Browse files Browse the repository at this point in the history
  • Loading branch information
forty2 authored and charlesw committed Apr 22, 2017
1 parent 91fa77a commit 80d8acf
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/Tesseract/ResultIterator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,11 @@ public FontAttributes GetWordFontAttributes() {
out isMonospace, out isSerif, out isSmallCaps,
out pointSize, out fontId);

// This can happen in certain error conditions
if (nameHandle == IntPtr.Zero) {
return null;
}

FontInfo fontInfo;
if (!_fontInfoCache.TryGetValue(fontId, out fontInfo)) {
string fontName = MarshalHelper.PtrToString(nameHandle, Encoding.UTF8);
Expand Down

0 comments on commit 80d8acf

Please sign in to comment.