From b4e11b0b493c88e94a205643767e3c744ae17fde Mon Sep 17 00:00:00 2001 From: Michael Vrhel Date: Tue, 27 Jan 2015 14:05:20 -0800 Subject: Catch exception thrown for case when character conversion fails --- platform/windows/gsview/mudocument.cs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'platform/windows') 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); } } -- cgit v1.2.3