1
0
mirror of https://github.com/GNS3/gns3-server synced 2024-12-26 00:38:10 +00:00

Fix a crash if font information is missing

Fix #700
This commit is contained in:
Julien Duponchelle 2016-09-30 10:30:24 +02:00
parent a7184f32bd
commit a01b55f07b
No known key found for this signature in database
GPG Key ID: CE8B29639E07F5E8
2 changed files with 3 additions and 1 deletions

View File

@ -406,7 +406,7 @@ def _convert_label(label):
""" """
Convert a label from 1.X to the new format Convert a label from 1.X to the new format
""" """
style = qt_font_to_style(label["font"], label["color"]) style = qt_font_to_style(label.get("font"), label["color"])
return { return {
"text": label["text"], "text": label["text"],
"rotation": 0, "rotation": 0,

View File

@ -24,6 +24,8 @@ def qt_font_to_style(font, color):
""" """
Convert a Qt font to CSS style Convert a Qt font to CSS style
""" """
if font is None:
font = "TypeWriter,10,-1,5,75,0,0,0,0,0"
font_info = font.split(",") font_info = font.split(",")
style = "font-family: {};font-size: {};".format(font_info[0], font_info[1]) style = "font-family: {};font-size: {};".format(font_info[0], font_info[1])
if font_info[4] == "75": if font_info[4] == "75":