mirror of
				https://github.com/arsenetar/dupeguru.git
				synced 2025-09-11 17:58:17 +00:00 
			
		
		
		
	[#96 state:fixed] Fixed a hard crash on calling get_blocks() with an empty path.
This commit is contained in:
		
							parent
							
								
									ac1593ff75
								
							
						
					
					
						commit
						56a39df635
					
				| @ -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)) | ||||
|  | ||||
| @ -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(); | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user