QPlainTextEdit: make sure firstVisibleBlock() is valid
Under some circumstances it's possible that firstVisibleBlock() returns an invalid block within QPlainTextEditPrivate::_q_textChanged() which results in a nullptr access later on. Therefore add a check similar to other places and test the validity of the returned block before accessing it. Fixes: QTBUG-80929 Change-Id: I1fd4643b10b842acfe1c356048379f0ba225dddf Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
This commit is contained in:
parent
02ddf08db8
commit
c623334248
@ -839,7 +839,8 @@ void QPlainTextEditPrivate::_q_textChanged()
|
||||
|
||||
placeholderVisible = !placeholderText.isEmpty()
|
||||
&& q->document()->isEmpty()
|
||||
&& q->firstVisibleBlock().layout()->preeditAreaText().isEmpty();
|
||||
&& (!q->firstVisibleBlock().isValid() ||
|
||||
q->firstVisibleBlock().layout()->preeditAreaText().isEmpty());
|
||||
|
||||
if (placeholderCurrentyVisible != placeholderVisible)
|
||||
viewport->update();
|
||||
|
Loading…
Reference in New Issue
Block a user