Skip to content

Commit b26ce47

Browse files
author
g_j_m
committed
Change an assert to an error message to avoid any future crashes like
that in ticket #136 git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@5572 c8812cc2-4d05-0410-92ff-de0c093fc19c
1 parent fd1eb1f commit b26ce47

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

src/providers/postgres/qgspostgresprovider.cpp

+9-2
Original file line numberDiff line numberDiff line change
@@ -1360,7 +1360,14 @@ void QgsPostgresProvider::findColumns(tableCols& cols)
13601360
ii = columnRelations.find(QString(ii->second.table_schema + '.' +
13611361
ii->second.table_name + '.' +
13621362
ii->second.column_name));
1363-
assert(ii != columnRelations.end());
1363+
if (ii == columnRelations.end())
1364+
{
1365+
std::cerr << "ERROR: Failed to find the column that "
1366+
<< ii->second.table_schema.local8Bit().data() << '.'
1367+
<< ii->second.table_name.local8Bit().data() << "."
1368+
<< ii->second.column_name.local8Bit().data()
1369+
<< " refers to.\n";
1370+
}
13641371
++count;
13651372
}
13661373

@@ -1373,7 +1380,7 @@ void QgsPostgresProvider::findColumns(tableCols& cols)
13731380
<< "interation limit (" << max_loops << ").\n";
13741381
cols[ii->second.view_column_name] = SRC("","","","");
13751382
}
1376-
else
1383+
else if (ii != columnRelations.end())
13771384
{
13781385
cols[ii->second.view_column_name] =
13791386
SRC(ii->second.table_schema,

0 commit comments

Comments
 (0)