File tree Expand file tree Collapse file tree 1 file changed +14
-0
lines changed Expand file tree Collapse file tree 1 file changed +14
-0
lines changed Original file line number Diff line number Diff line change @@ -433,6 +433,11 @@ abstract class PerAccountStoreBase {
433433 // See `UpdateMachine.load`.
434434 Uri get realmIcon => account.realmIcon! ;
435435
436+ /// Resolve [realmIcon] as a URL relative to [realmUrl] .
437+ ///
438+ /// This returns null if resolving fails.
439+ Uri ? resolveRealmIconUrl () => _tryResolveUrl (realmUrl, realmIcon);
440+
436441 /// Resolve [reference] as a URL relative to [realmUrl] .
437442 ///
438443 /// This returns null if [reference] fails to parse as a URL.
@@ -474,6 +479,15 @@ Uri? _tryResolveUrlStr(Uri baseUrl, String reference) {
474479 }
475480}
476481
482+ /// Like [Uri.resolve] , but on failure return null instead of throwing.
483+ Uri ? _tryResolveUrl (Uri baseUrl, Uri reference) {
484+ try {
485+ return baseUrl.resolveUri (reference);
486+ } on FormatException {
487+ return null ;
488+ }
489+ }
490+
477491/// Store for the user's data for a given Zulip account.
478492///
479493/// This should always have a consistent snapshot of the state on the server,
You can’t perform that action at this time.
0 commit comments