Conform more of the codebase to strictNullChecks (#10800)
This commit is contained in:
parent
adb29b38a3
commit
456c66db5b
46 changed files with 147 additions and 123 deletions
|
@ -20,6 +20,7 @@ import { Optional } from "matrix-events-sdk";
|
|||
|
||||
import { MatrixClientPeg } from "../MatrixClientPeg";
|
||||
import { IMediaEventContent, IPreparedMedia, prepEventContentAsMedia } from "./models/IMediaEventContent";
|
||||
import { UserFriendlyError } from "../languageHandler";
|
||||
|
||||
// Populate this class with the details of your customisations when copying it.
|
||||
|
||||
|
@ -141,7 +142,11 @@ export class Media {
|
|||
* @returns {Promise<Response>} Resolves to the server's response for chaining.
|
||||
*/
|
||||
public downloadSource(): Promise<Response> {
|
||||
return fetch(this.srcHttp);
|
||||
const src = this.srcHttp;
|
||||
if (!src) {
|
||||
throw new UserFriendlyError("Failed to download source media, no source url was found");
|
||||
}
|
||||
return fetch(src);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue