mirror of
https://git.proxmox.com/git/fwupd
synced 2025-07-27 12:54:58 +00:00
trivial: Prevent critical warning when calling fu_chunk_array_new() on zero-sized data
This commit is contained in:
parent
179f250b9a
commit
2d9d93ec76
@ -420,9 +420,9 @@ fu_chunk_array_new(const guint8 *data,
|
|||||||
guint32 idx;
|
guint32 idx;
|
||||||
guint32 last_flush = 0;
|
guint32 last_flush = 0;
|
||||||
|
|
||||||
g_return_val_if_fail(data_sz > 0, NULL);
|
|
||||||
|
|
||||||
chunks = g_ptr_array_new_with_free_func((GDestroyNotify)g_object_unref);
|
chunks = g_ptr_array_new_with_free_func((GDestroyNotify)g_object_unref);
|
||||||
|
if (data_sz == 0)
|
||||||
|
return chunks;
|
||||||
for (idx = 1; idx < data_sz; idx++) {
|
for (idx = 1; idx < data_sz; idx++) {
|
||||||
guint32 page = 0;
|
guint32 page = 0;
|
||||||
if (page_sz > 0)
|
if (page_sz > 0)
|
||||||
|
Loading…
Reference in New Issue
Block a user