Bug 803791 - Guard against allocating a zero-capacity direct buffer. r=cpeterson

This commit is contained in:
Kartikaya Gupta 2013-01-23 00:00:22 -05:00
Родитель 8ee4018a47
Коммит 58056c0bdc
1 изменённых файлов: 3 добавлений и 1 удалений

Просмотреть файл

@ -112,10 +112,12 @@ final class ThumbnailHelper {
}
try {
mBuffer = DirectBufferAllocator.allocate(capacity);
} catch (IllegalArgumentException iae) {
Log.w(LOGTAG, iae.toString());
} catch (OutOfMemoryError oom) {
Log.w(LOGTAG, "Unable to allocate thumbnail buffer of capacity " + capacity);
// At this point mBuffer will be pointing to null, so we are in a sane state.
}
// If we hit an error above, mBuffer will be pointing to null, so we are in a sane state.
}
}