mirror of
https://git.notmuchmail.org/git/notmuch
synced 2024-11-21 18:38:08 +01:00
Avoid potentially dereferencing a NULL pointer
GMIME_IS_MULTIPART and GMIME_IS_MESSAGE both handle NULL pointers gracefully, but the G_OBJECT_TYPE used in the error handling block dereferences it without checking it first. Fix this by checking whether parent->part is valid. Found using the clang static analyzer. Signed-off-by: Justus Winter <4winter@informatik.uni-hamburg.de>
This commit is contained in:
parent
2f40ca28a4
commit
b6b08e40b3
1 changed files with 1 additions and 1 deletions
|
@ -291,7 +291,7 @@ mime_node_child (mime_node_t *parent, int child)
|
|||
GMimeObject *sub;
|
||||
mime_node_t *node;
|
||||
|
||||
if (!parent || child < 0 || child >= parent->nchildren)
|
||||
if (!parent || !parent->part || child < 0 || child >= parent->nchildren)
|
||||
return NULL;
|
||||
|
||||
if (GMIME_IS_MULTIPART (parent->part)) {
|
||||
|
|
Loading…
Reference in a new issue