1
mirror of https://invent.kde.org/network/falkon.git synced 2024-11-13 10:32:11 +01:00

[PageFormCompleter] Try to be extra cautious with QWebFrames

This is an attempt to fix crash when calling QWebFrame::childFrames
in PageFormCompleter::getAllElementsFromPage

[ci skip]
This commit is contained in:
nowrep 2014-04-06 15:13:07 +02:00
parent 39c9fec3dd
commit 6e18ee7502

View File

@ -233,15 +233,15 @@ QWebElementCollection PageFormCompleter::getAllElementsFromPage(const QString &s
{ {
QWebElementCollection list; QWebElementCollection list;
if (!m_page) { if (!m_page || !m_page->mainFrame())
return list; return list;
}
QList<QWebFrame*> frames; QList<QWebFrame*> frames;
frames.append(m_page->mainFrame()); frames.append(m_page->mainFrame());
while (!frames.isEmpty()) { while (!frames.isEmpty()) {
QWebFrame* frame = frames.takeFirst(); QWebFrame* frame = frames.takeFirst();
if (frame) { if (frame && !frame->documentElement().isNull()) {
list.append(frame->findAllElements(selector)); list.append(frame->findAllElements(selector));
frames += frame->childFrames(); frames += frame->childFrames();
} }