Check if matrix homeserver is not null for MxContent
This commit is contained in:
		
							parent
							
								
									36c17c7fca
								
							
						
					
					
						commit
						c13b23dd0a
					
				|  | @ -35,8 +35,9 @@ class MxContent { | ||||||
|   get mxc => _mxc; |   get mxc => _mxc; | ||||||
| 
 | 
 | ||||||
|   /// Returns a download Link to this content. |   /// Returns a download Link to this content. | ||||||
|   String getDownloadLink(Client matrix) => |   String getDownloadLink(Client matrix) => matrix.homeserver != null | ||||||
|       "${matrix.homeserver}/_matrix/media/r0/download/${_mxc.replaceFirst("mxc://", "")}"; |       ? "${matrix.homeserver}/_matrix/media/r0/download/${_mxc.replaceFirst("mxc://", "")}" | ||||||
|  |       : ""; | ||||||
| 
 | 
 | ||||||
|   /// Returns a scaled thumbnail link to this content with the given [width] and |   /// Returns a scaled thumbnail link to this content with the given [width] and | ||||||
|   /// [height]. [method] can be [ThumbnailMethod.crop] or |   /// [height]. [method] can be [ThumbnailMethod.crop] or | ||||||
|  | @ -47,7 +48,9 @@ class MxContent { | ||||||
|     if (method == ThumbnailMethod.scale) methodStr = "scale"; |     if (method == ThumbnailMethod.scale) methodStr = "scale"; | ||||||
|     width = width.round(); |     width = width.round(); | ||||||
|     height = height.round(); |     height = height.round(); | ||||||
|     return "${matrix.homeserver}/_matrix/media/r0/thumbnail/${_mxc.replaceFirst("mxc://", "")}?width=$width&height=$height&method=$methodStr"; |     return matrix.homeserver != null | ||||||
|  |         ? "${matrix.homeserver}/_matrix/media/r0/thumbnail/${_mxc.replaceFirst("mxc://", "")}?width=$width&height=$height&method=$methodStr" | ||||||
|  |         : ""; | ||||||
|   } |   } | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue