diff --git a/src/widgets/styles/qstylesheetstyle.cpp b/src/widgets/styles/qstylesheetstyle.cpp index 0437561d13..6abef62835 100644 --- a/src/widgets/styles/qstylesheetstyle.cpp +++ b/src/widgets/styles/qstylesheetstyle.cpp @@ -4612,11 +4612,14 @@ void QStyleSheetStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *op case PE_PanelLineEdit: if (const QStyleOptionFrame *frm = qstyleoption_cast(opt)) { - if (QWidget *container = containerWidget(w); container != w) { - QRenderRule containerRule = renderRule(container, opt); - if (!containerRule.hasNativeBorder() || !containerRule.baseStyleCanDraw()) - return; - rule = containerRule; + // Fall back to container widget's render rule + if (w) { + if (QWidget *container = containerWidget(w); container != w) { + QRenderRule containerRule = renderRule(container, opt); + if (!containerRule.hasNativeBorder() || !containerRule.baseStyleCanDraw()) + return; + rule = containerRule; + } } if (rule.hasNativeBorder()) {