qdbusxml2cpp: Check string length before checking for \r\n.

Change-Id: I5370bae258933536ecf9785da95a9006fafc1a62
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
Jon Severinsson 2012-12-22 23:45:15 +01:00 committed by The Qt Project
parent afa57146cb
commit e2fb3f94e8

View File

@ -498,7 +498,7 @@ static QString stringify(const QString &data)
retval += QLatin1String("\\\"");
else
retval += data[i];
if (data[i] == QLatin1Char('\r') && data[i+1] == QLatin1Char('\n'))
if (i+1 < data.length() && data[i] == QLatin1Char('\r') && data[i+1] == QLatin1Char('\n'))
i++;
retval += QLatin1String("\\n\"\n");
}