Bug report #16613

Updated by Jürgen Fischer over 7 years ago

When opening PostGIS layer QGIS crashes.

Here it is part of the dump.

> src/app/qgisapp.cpp: 9843: (addVectorLayer) [1ms] got valid layer with 0 sublayers
> Fatal: ASSERT failure in QList<T>::at: "index out of range", file /usr/include/x86_64-linux-gnu/qt5/QtCore/qlist.h, line 537
> QGIS died on signal -1[New LWP 10697]

In sources I see using same named variables: QStringList sublayers

The first variable declared here: source:src/app/qgisapp.cpp#L9840 https://github.com/qgis/QGIS/blob/master/src/app/qgisapp.cpp#L9840
And second here: source:src/app/qgisapp.cpp#L9860 https://github.com/qgis/QGIS/blob/master/src/app/qgisapp.cpp#L9860

When get 0 element from list, first variable is using, not second, as expected: source:src/app/qgisapp.cpp#L9863 https://github.com/qgis/QGIS/blob/master/src/app/qgisapp.cpp#L9863

The solutions are:

# Rename second variable
# Remove second variable declaration

Back