History

Fix invalid remote scripts being loaded

Ryan Huffman committed 12 years ago

Commit 89fbeb01 parent 58434251 file · +6 −1Browse files

Showing the changes to libraries/script-engine/src/ScriptEngine.cpp (1 of 1 file). Show all

Unified · Split

libraries/script-engine/src/ScriptEngine.cpp+6−1
@@ -147,7 +147,12 @@ ScriptEngine::ScriptEngine(const QUrl& scriptURL, · 146 unmodified lines
147 QEventLoop loop;147 QEventLoop loop;
148 QObject::connect(reply, SIGNAL(finished()), &loop, SLOT(quit()));148 QObject::connect(reply, SIGNAL(finished()), &loop, SLOT(quit()));
149 loop.exec();149 loop.exec();
150 _scriptContents = reply->readAll();150 if (reply->error() == QNetworkReply::NoError && reply->attribute(QNetworkRequest::HttpStatusCodeAttribute) == 200) {
151 _scriptContents = reply->readAll();
152 } else {
153 qDebug() << "ERROR Loading file:" << url.toString();
154 emit errorMessage("ERROR Loading file:" + url.toString());
155 }
151 }156 }
152 }157 }
153}158}