Merge pull request #16 from vector-im/bwindels/dontcrashoninvalidimg

Don't crash on m.image without url
This commit is contained in:
Bruno Windels 2020-08-17 08:32:21 +00:00 committed by GitHub
commit 4f5609f7c1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -27,12 +27,18 @@ export class ImageTile extends MessageTile {
get thumbnailUrl() { get thumbnailUrl() {
const mxcUrl = this._getContent().url; const mxcUrl = this._getContent().url;
return this._room.mxcUrlThumbnail(mxcUrl, this.thumbnailWidth, this.thumbnailHeight, "scale"); if (mxcUrl) {
return this._room.mxcUrlThumbnail(mxcUrl, this.thumbnailWidth, this.thumbnailHeight, "scale");
}
return null;
} }
get url() { get url() {
const mxcUrl = this._getContent().url; const mxcUrl = this._getContent().url;
return this._room.mxcUrl(mxcUrl); if (mxcUrl) {
return this._room.mxcUrl(mxcUrl);
}
return null;
} }
_scaleFactor() { _scaleFactor() {