summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Vrhel <michael.vrhel@artifex.com>2015-01-27 14:05:20 -0800
committerMichael Vrhel <michael.vrhel@artifex.com>2015-01-27 14:05:20 -0800
commitb4e11b0b493c88e94a205643767e3c744ae17fde (patch)
tree677a153f1d91dbc561baad39eb1c1c305acb4ddc
parent5776c7dc1aacd58511c9ffb06357b970f2fea7ae (diff)
downloadmupdf-b4e11b0b493c88e94a205643767e3c744ae17fde.tar.xz
Catch exception thrown for case when character conversion fails
-rw-r--r--platform/windows/gsview/mudocument.cs10
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);
}
}