How about: "if (!avatarImageUrl.scheme().isEmpty() && avatarImageUrl.scheme() != "file")