aboutsummaryrefslogtreecommitdiffstats
path: root/src/declarative/qml/parser/qdeclarativejslexer.cpp
diff options
context:
space:
mode:
authorRoberto Raggi <roberto.raggi@nokia.com>2011-08-01 18:03:41 +0200
committerQt by Nokia <qt-info@nokia.com>2011-08-30 13:18:28 +0200
commitf0080a389b0742f64106863e585bb71defed897d (patch)
tree6307c356ea3fd89fcfc2bff8e4f38b4e8f236a93 /src/declarative/qml/parser/qdeclarativejslexer.cpp
parent101dfc3bf2694d822d44f7632a2cc7dd1196f67c (diff)
Fix possible crash when using the QML lexer without an engine.
Change-Id: Ia7d820cf1a63eaf42041ab78e1f111d31358e4dd Reviewed-on: http://codereview.qt.nokia.com/3779 Reviewed-by: Roberto Raggi <roberto.raggi@nokia.com> Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com>
Diffstat (limited to 'src/declarative/qml/parser/qdeclarativejslexer.cpp')
-rw-r--r--src/declarative/qml/parser/qdeclarativejslexer.cpp18
1 files changed, 10 insertions, 8 deletions
diff --git a/src/declarative/qml/parser/qdeclarativejslexer.cpp b/src/declarative/qml/parser/qdeclarativejslexer.cpp
index b3530c0596..6015f385df 100644
--- a/src/declarative/qml/parser/qdeclarativejslexer.cpp
+++ b/src/declarative/qml/parser/qdeclarativejslexer.cpp
@@ -536,16 +536,18 @@ again:
const QChar *startCode = _codePtr;
- while (!_char.isNull()) {
- if (_char == QLatin1Char('\n') || _char == QLatin1Char('\\')) {
- break;
- } else if (_char == quote) {
- _tokenSpell = _engine->midRef(startCode - _code.unicode() - 1, _codePtr - startCode);
- scanChar();
+ if (_engine) {
+ while (!_char.isNull()) {
+ if (_char == QLatin1Char('\n') || _char == QLatin1Char('\\')) {
+ break;
+ } else if (_char == quote) {
+ _tokenSpell = _engine->midRef(startCode - _code.unicode() - 1, _codePtr - startCode);
+ scanChar();
- return T_STRING_LITERAL;
+ return T_STRING_LITERAL;
+ }
+ scanChar();
}
- scanChar();
}
_tokenText.resize(0);