Skip to content
Permalink
Browse files

Fixes segmentation fault when dividing by zero

  • Loading branch information
pblottiere committed May 17, 2018
1 parent d5cec14 commit 352dbcb8367e73d6ab9f28aa815ff378bbb1db14
Showing with 5 additions and 1 deletion.
  1. +5 −1 src/gui/editorwidgets/qgsvaluerelationwidgetwrapper.cpp
@@ -259,7 +259,11 @@ void QgsValueRelationWidgetWrapper::populate( )
else if ( mTableWidget )
{
if ( mCache.size() > 0 )
mTableWidget->setRowCount( ( mCache.size() + config( QStringLiteral( "NofColumns" ) ).toInt() - 1 ) / config( QStringLiteral( "NofColumns" ) ).toInt() );
{
const int nofCols = config( QStringLiteral( "NofColumns" ) ).toInt();
const int denom = nofCols != 0 ? nofCols : 1;
mTableWidget->setRowCount( ( mCache.size() + nofCols - 1 ) / denom );
}
else
mTableWidget->setRowCount( 1 );
if ( config( QStringLiteral( "NofColumns" ) ).toInt() > 0 )

0 comments on commit 352dbcb

Please sign in to comment.
You can’t perform that action at this time.