avoid crash on urls with missing protocols

Daniel Gultsch created

Change summary

src/main/java/eu/siacs/conversations/entities/Message.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

Detailed changes

src/main/java/eu/siacs/conversations/entities/Message.java 🔗

@@ -655,7 +655,7 @@ public class Message extends AbstractEntity {
 			final String protocol = url.getProtocol();
 			final boolean encrypted = ref != null && ref.matches("([A-Fa-f0-9]{2}){48}");
 			return (AesGcmURLStreamHandler.PROTOCOL_NAME.equalsIgnoreCase(protocol) && encrypted)
-					|| ((protocol.equalsIgnoreCase("http") || protocol.equalsIgnoreCase("https")) && (oob || encrypted));
+					|| (("http".equalsIgnoreCase(protocol) || "https".equalsIgnoreCase(protocol)) && (oob || encrypted));
 
 		} catch (MalformedURLException e) {
 			return false;