diff --git a/modules/gui/qt/util/qsgroundedrectangularimagenode.cpp b/modules/gui/qt/util/qsgroundedrectangularimagenode.cpp
index ccb60a836d015338c1b39718c13733f43ef4d38f..6fba801989570932e4eeacc29536a7edd0aa6778 100644
--- a/modules/gui/qt/util/qsgroundedrectangularimagenode.cpp
+++ b/modules/gui/qt/util/qsgroundedrectangularimagenode.cpp
@@ -29,7 +29,7 @@ template<class T>
 T QSGRoundedRectangularImageNode::material_cast(QSGMaterial* const material)
 {
 #ifdef NDEBUG
-    return static_cast<T>(object);
+    return static_cast<T>(material);
 #else
     const auto ret = dynamic_cast<T>(material);
     assert(ret); // incompatible material type