fix for possible blank / invalid video thumbnails

This commit is contained in:
Akinwale Ariwodola 2020-05-22 05:17:10 +01:00
parent 616e3597db
commit 2f7e999e49

View file

@ -661,7 +661,14 @@ public class PublishFormFragment extends BaseFragment implements
} }
private void checkAndUploadThumbnail(String filePath, String thumbnailPath, String type) { private void checkAndUploadThumbnail(String filePath, String thumbnailPath, String type) {
if (Helper.isNullOrEmpty(thumbnailPath)) { boolean thumbnailValid = false;
if (!Helper.isNullOrEmpty(thumbnailPath)) {
File file = new File(thumbnailPath);
// make sure the file exists and it's not an empty file
thumbnailValid = file.exists() && file.length() > 0;
}
if (!thumbnailValid) {
createAndUploadThumbnail(filePath, type); createAndUploadThumbnail(filePath, type);
} else { } else {
uploadThumbnail(thumbnailPath); uploadThumbnail(thumbnailPath);