diff options
author | Michael Vrhel <michael.vrhel@artifex.com> | 2015-01-27 14:05:20 -0800 |
---|---|---|
committer | Michael Vrhel <michael.vrhel@artifex.com> | 2015-01-27 14:05:20 -0800 |
commit | b4e11b0b493c88e94a205643767e3c744ae17fde (patch) | |
tree | 677a153f1d91dbc561baad39eb1c1c305acb4ddc /platform/windows | |
parent | 5776c7dc1aacd58511c9ffb06357b970f2fea7ae (diff) | |
download | mupdf-b4e11b0b493c88e94a205643767e3c744ae17fde.tar.xz |
Catch exception thrown for case when character conversion fails
Diffstat (limited to 'platform/windows')
-rw-r--r-- | platform/windows/gsview/mudocument.cs | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/platform/windows/gsview/mudocument.cs b/platform/windows/gsview/mudocument.cs index 291a424e..3087d3d0 100644 --- a/platform/windows/gsview/mudocument.cs +++ b/platform/windows/gsview/mudocument.cs @@ -1375,7 +1375,15 @@ namespace gsview textchars.Height = height; textchars.Scale = 1.0; textchars.Color = linecolor; - textchars.character = System.Convert.ToChar(character).ToString(); + try + { + textchars.character = System.Convert.ToChar(character).ToString(); + } + catch (OverflowException) + { + textchars.character = " "; /* Something went wrong here. Use blank space */ + Console.WriteLine("{0} is outside the range of the Char data type.", character); + } blocks[kk].TextLines[jj].TextCharacters.Add(textchars); } } |