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