Hi to all!
I have following method with its code:
qint16 CApplicationSettings::searchSettingsForIndex(const QString& strHub, const QString& strKey)
{
if(m_SettingsValues.size()>0)
for (qint16 iIndex=0; iIndex=m_SettingsValues.size(); iIndex++)
if(m_SettingsValues.at(iIndex).strHub==strHub)
if(m_SettingsValues.at(iIndex).strKey==strKey)
return iIndex; // returns index of found record
return RECORD_NOT_FOUND; // not found
}
qint16 CApplicationSettings::searchSettingsForIndex(const QString& strHub, const QString& strKey)
{
if(m_SettingsValues.size()>0)
for (qint16 iIndex=0; iIndex=m_SettingsValues.size(); iIndex++)
if(m_SettingsValues.at(iIndex).strHub==strHub)
if(m_SettingsValues.at(iIndex).strKey==strKey)
return iIndex; // returns index of found record
return RECORD_NOT_FOUND; // not found
}
To copy to clipboard, switch view to plain text mode
Once called, the application crashes with following error:
warning: Lowest section in C:\WINDOWS\system32\xpsp2res.dll is .rsrc at 20001000
Current language: auto; currently c++
warning: ASSERT failure in QList<T>::at: "index out of range", file ../../../../Qt/4.3.4/include/QtCore/../../src/corelib/tools/qlist.h, line 391
warning: Lowest section in C:\WINDOWS\system32\xpsp2res.dll is .rsrc at 20001000
warning: QLayout: Cannot add null widget to QHBoxLayout/
Current language: auto; currently c++
warning: ASSERT failure in QList<T>::at: "index out of range", file ../../../../Qt/4.3.4/include/QtCore/../../src/corelib/tools/qlist.h, line 391
To copy to clipboard, switch view to plain text mode
It is obvious I try to read out of range record, but I simply do not get it why? This code seems perfect to me ... The app crashes in line 5 of method, in the first comparsion.
Bookmarks