mirror of
https://github.com/yuzu-emu/unicorn.git
synced 2025-02-02 07:21:01 +00:00
qlist: Make conversion from QObject * accept null
qobject_to_qlist() crashes on null, which is a trap for the unwary. Return null instead. Backports commit 2d6421a90047a83f6722832405fe09571040ea5b from qemu
This commit is contained in:
parent
218e3ab5d5
commit
d25b8420d0
|
@ -142,10 +142,9 @@ size_t qlist_size(const QList *qlist)
|
|||
*/
|
||||
QList *qobject_to_qlist(const QObject *obj)
|
||||
{
|
||||
if (qobject_type(obj) != QTYPE_QLIST) {
|
||||
if (!obj || qobject_type(obj) != QTYPE_QLIST) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return container_of(obj, QList, base);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue