ASSERT failure in QList<T>::operator[]: "index out of range", file C:/Qt/Qt5.3.2/5.3/mingw482_32/include/QtCore/qlist.h, line 487

問題

アプリケーションが次のエラーで終了する。

ASSERT failure in QList<T>::operator[]: "index out of range", file C:/Qt/Qt5.3.2/5.3/mingw482_32/include/QtCore/qlist.h, line 487
Invalid parameter passed to C runtime function.
Invalid parameter passed to C runtime function.
原因

リストに存在しない要素にアクセスしていたため。

app.arguments()[1] == "option";
解決策

[] の代わりに value() を使う。

app.arguments().value(1) == "option";