[gnome-characters] characterList: Add NULL check for character name



commit a3b7e7e6ac67d2542ec126822608f0480b1921c0
Author: Daiki Ueno <dueno src gnome org>
Date:   Mon Jan 9 14:58:51 2017 +0100

    characterList: Add NULL check for character name
    
    https://bugzilla.gnome.org/show_bug.cgi?id=776845

 src/characterList.js |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)
---
diff --git a/src/characterList.js b/src/characterList.js
index 2463505..c5ba901 100644
--- a/src/characterList.js
+++ b/src/characterList.js
@@ -174,8 +174,9 @@ const CharacterListRow = new Lang.Class({
         layout.set_ellipsize(Pango.EllipsizeMode.END);
         layout.set_alignment(Pango.Alignment.CENTER);
         layout.set_font_description(this._overlayFontDescription);
-        var name = Gc.character_name(uc);
-        layout.set_text(Util.capitalize(name), -1);
+        let name = Gc.character_name(uc);
+        let text = name == null ? _('Unassigned') : Util.capitalize(name);
+        layout.set_text(text, -1);
         let [logicalRect, inkRect] = layout.get_extents();
         cr.moveTo(cellRect.x - logicalRect.x / Pango.SCALE +
                   (cellRect.width - logicalRect.width / Pango.SCALE) / 2,


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]