Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
ImportedProjects
SVG
Commits
ec99fa95
Commit
ec99fa95
authored
Dec 20, 2018
by
H1Gdev
Committed by
mrbean-bremen
Dec 20, 2018
Browse files
Fix: Crash viewer when entering text.
- Catch exceptions in event handler.
parent
838008c1
Changes
1
Show whitespace changes
Inline
Side-by-side
Samples/SVGViewer/SvgViewer.cs
View file @
ec99fa95
...
...
@@ -21,6 +21,8 @@ namespace SVGViewer
}
private
void
open_Click
(
object
sender
,
EventArgs
e
)
{
try
{
if
(
openSvgFile
.
ShowDialog
()
==
DialogResult
.
OK
)
{
...
...
@@ -28,15 +30,25 @@ namespace SVGViewer
RenderSvg
(
svgDoc
);
}
}
catch
{
}
}
private
void
textBox1_TextChanged
(
object
sender
,
EventArgs
e
)
{
using
(
var
s
=
new
MemoryStream
(
Encoding
.
UTF8
.
GetBytes
(
textBox1
.
Text
)))
try
{
using
(
var
s
=
new
MemoryStream
(
Encoding
.
UTF8
.
GetBytes
(
textBox1
.
Text
)))
{
SvgDocument
svgDoc
=
SvgDocument
.
Open
<
SvgDocument
>(
s
,
null
);
RenderSvg
(
svgDoc
);
}
}
catch
{
}
}
private
void
RenderSvg
(
SvgDocument
svgDoc
)
{
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment