handle invalid image bounds
This commit is contained in:
parent
157d644750
commit
6fe5c5e770
|
@ -888,7 +888,9 @@ public class FileBackend {
|
|||
if (image || video) {
|
||||
try {
|
||||
Dimensions dimensions = image ? getImageDimensions(file) : getVideoDimensions(file);
|
||||
if (dimensions.valid()) {
|
||||
body.append('|').append(dimensions.width).append('|').append(dimensions.height);
|
||||
}
|
||||
} catch (NotAVideoFile notAVideoFile) {
|
||||
Log.d(Config.LOGTAG, "file with mime type " + file.getMimeType() + " was not a video file");
|
||||
//fall threw
|
||||
|
@ -1015,6 +1017,10 @@ public class FileBackend {
|
|||
public int getMin() {
|
||||
return Math.min(width, height);
|
||||
}
|
||||
|
||||
public boolean valid() {
|
||||
return width > 0 && height > 0;
|
||||
}
|
||||
}
|
||||
|
||||
private static class NotAVideoFile extends Exception {
|
||||
|
|
|
@ -790,9 +790,7 @@ public class MessageAdapter extends ArrayAdapter<Message> implements CopyTextVie
|
|||
} else {
|
||||
displayInfoMessage(viewHolder, UIHelper.getMessagePreview(activity, message).first, darkBackground);
|
||||
}
|
||||
} else if (message.getType() == Message.TYPE_IMAGE && message.getEncryption() != Message.ENCRYPTION_PGP && message.getEncryption() != Message.ENCRYPTION_DECRYPTION_FAILED) {
|
||||
displayImageMessage(viewHolder, message);
|
||||
} else if (message.getType() == Message.TYPE_FILE && message.getEncryption() != Message.ENCRYPTION_PGP && message.getEncryption() != Message.ENCRYPTION_DECRYPTION_FAILED) {
|
||||
} else if (message.isFileOrImage() && message.getEncryption() != Message.ENCRYPTION_PGP && message.getEncryption() != Message.ENCRYPTION_DECRYPTION_FAILED) {
|
||||
if (message.getFileParams().width > 0 && message.getFileParams().height > 0) {
|
||||
displayImageMessage(viewHolder, message);
|
||||
} else if (message.getFileParams().runtime > 0) {
|
||||
|
|
Loading…
Reference in a new issue