Skip to content

Commit

Permalink
fix: settings screen crash
Browse files Browse the repository at this point in the history
  • Loading branch information
Dwynr committed Jun 27, 2023
1 parent 406c31b commit d849e0a
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/screens/SettingsScreen/SettingsScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,7 @@ export const SettingsHeader = memo(({ navigation, navigationEnabled = true }: Se

const cacheUserAvatar = () => {
if (typeof userInfo !== "undefined") {
if (userInfo.avatarURL.indexOf("https://") !== -1) {
if (typeof userInfo.avatarURL === "string" && userInfo.avatarURL.indexOf("https://") !== -1) {
const avatarName = getFilenameFromPath(userInfo.avatarURL)

if (userAvatarCached !== avatarName) {
Expand Down Expand Up @@ -433,9 +433,14 @@ export const SettingsHeader = memo(({ navigation, navigationEnabled = true }: Se
>
<FastImage
source={
typeof userAvatarCached == "string" && userAvatarCached.length > 4
typeof userAvatarCached == "string" &&
userAvatarCached.length > 4 &&
typeof userInfo !== "undefined" &&
typeof userInfo.avatarURL === "string"
? { uri: "file://" + MISC_BASE_PATH + userAvatarCached }
: typeof userInfo !== "undefined" && userInfo.avatarURL.indexOf("https://down.") !== -1
: typeof userInfo !== "undefined" &&
typeof userInfo.avatarURL === "string" &&
userInfo.avatarURL.indexOf("https://down.") !== -1
? { uri: userInfo.avatarURL }
: require("../../assets/images/appstore.png")
}
Expand Down

0 comments on commit d849e0a

Please sign in to comment.