1
0
mirror of https://github.com/arsenetar/dupeguru.git synced 2025-03-10 05:34:36 +00:00

[#96 state:fixed] Fixed a hard crash on calling get_blocks() with an empty path.

This commit is contained in:
Virgil Dupras 2010-07-14 09:36:35 +02:00
parent ac1593ff75
commit 56a39df635
2 changed files with 6 additions and 1 deletions

View File

@ -40,7 +40,7 @@ def prepare_pictures(pictures, cache_path, j=job.nulljob):
blocks = picture.get_blocks(BLOCK_COUNT_PER_SIDE)
cache[picture.unicode_path] = blocks
prepared.append(picture)
except IOError as e:
except (IOError, ValueError) as e:
logging.warning(unicode(e))
except MemoryError:
logging.warning(u'Ran out of memory while reading %s of size %d' % (picture.unicode_path, picture.size))

View File

@ -158,6 +158,11 @@ static PyObject* block_osx_getblocks(PyObject *self, PyObject *args)
return NULL;
}
if (PySequence_Length(path) == 0) {
PyErr_SetString(PyExc_ValueError, "empty path");
return NULL;
}
image_path = pystring2cfstring(path);
if (image_path == NULL) {
return PyErr_NoMemory();