Skip to content

Commit

Permalink
Stop potential crash by guarding the access to the page.
Browse files Browse the repository at this point in the history
  • Loading branch information
ariya committed Sep 24, 2012
1 parent 63e06cb commit 8ba3c52
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/phantom.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -315,6 +315,9 @@ QObject* Phantom::createCallback()

void Phantom::loadModule(const QString &moduleSource, const QString &filename)
{
if (m_terminated)
return;

QString scriptSource =
"(function(require, exports, module) {" +
moduleSource +
Expand All @@ -328,6 +331,9 @@ void Phantom::loadModule(const QString &moduleSource, const QString &filename)

bool Phantom::injectJs(const QString &jsFilePath)
{
if (m_terminated)
return false;

return Utils::injectJsInFrame(jsFilePath, libraryPath(), m_page->mainFrame());
}

Expand Down

0 comments on commit 8ba3c52

Please sign in to comment.