Don't crash if a file is deleted before OCR is completed

This commit is contained in:
jendib 2015-04-29 01:28:42 +02:00
parent b8061a6a1e
commit c283607063

View File

@ -48,6 +48,11 @@ public class FileCreatedAsyncListener {
@Override @Override
public void run() { public void run() {
FileDao fileDao = new FileDao(); FileDao fileDao = new FileDao();
if (fileDao.getById(file.getId()) == null) {
// The file has been deleted since the OCR-ization started, ignore the result
return;
}
file.setContent(content); file.setContent(content);
fileDao.update(file); fileDao.update(file);
} }