diff --git a/src/svg/qsvghandler.cpp b/src/svg/qsvghandler.cpp
index 7b82e28..cccd8c7 100644
--- a/src/svg/qsvghandler.cpp
+++ b/src/svg/qsvghandler.cpp
@@ -3655,6 +3655,8 @@ void QSvgHandler::init()
 
 static bool detectCycles(const QSvgNode *node, QList<const QSvgUse *> active = {})
 {
+    if (Q_UNLIKELY(!node))
+        return false;
     switch (node->type()) {
     case QSvgNode::DOC:
     case QSvgNode::G:


