Fix error in gr-limited-text

gr-limited-text.js:66 Uncaught (in promise) TypeError: Cannot read
property 'length' of null

Change-Id: Iba8c7d832e7a0e6460d67f9c6fa26ed9bdc05469
This commit is contained in:
Becky Siegel
2017-10-03 14:39:41 +01:00
parent ffd100f66f
commit cd35a0ea87

View File

@@ -54,7 +54,7 @@
* enabled. * enabled.
*/ */
_updateTitle(text, limit) { _updateTitle(text, limit) {
this.hasTooltip = !!limit && text.length > limit; this.hasTooltip = !!limit && !!text && text.length > limit;
if (this.hasTooltip) { if (this.hasTooltip) {
this.setAttribute('title', text); this.setAttribute('title', text);
} else { } else {
@@ -63,7 +63,7 @@
}, },
_computeDisplayText(text, limit) { _computeDisplayText(text, limit) {
if (!!limit && text.length > limit) { if (!!limit && !!text && text.length > limit) {
return text.substr(0, limit - 1) + '…'; return text.substr(0, limit - 1) + '…';
} }
return text; return text;