Skip to content
Permalink
Browse files

[GRASS] fixed crash when running module with file input

  • Loading branch information
blazek committed Aug 31, 2015
1 parent d125e3f commit b9f6d7837a1368e88533eb199bf47cca178b0d30
Showing with 10 additions and 12 deletions.
  1. +7 −9 src/plugins/grass/qgsgrassmoduleparam.cpp
  2. +3 −3 src/plugins/grass/qgsgrassmoduleparam.h
@@ -705,17 +705,15 @@ QStringList QgsGrassModuleOption::options()

QString QgsGrassModuleOption::ready()
{
QgsDebugMsg( "called." );
QgsDebugMsg( "key = " + key() );

QString error;

if ( mControlType == LineEdit )
if ( value().isEmpty() && mRequired )
{
if ( mLineEdits.at( 0 )->text().trimmed().length() == 0 && mRequired )
{
error.append( tr( "%1: missing value" ).arg( title() ) );
}
error.append( tr( "%1: missing value" ).arg( title() ) );
}

return error;
}

@@ -1424,7 +1422,7 @@ void QgsGrassModuleGroupBoxItem::adjustTitle()
/***************** QgsGrassModuleGdalInput *********************/

QgsGrassModuleGdalInput::QgsGrassModuleGdalInput(
QgsGrassModule *module, int type, QString key, QDomElement &qdesc,
QgsGrassModule *module, Type type, QString key, QDomElement &qdesc,
QDomElement &gdesc, QDomNode &gnode, bool direct, QWidget * parent )
: QgsGrassModuleGroupBoxItem( module, key, qdesc, gdesc, gnode, direct, parent )
, mType( type )
@@ -1694,7 +1692,7 @@ QString QgsGrassModuleGdalInput::ready()

void QgsGrassModuleGdalInput::changed( int i )
{
mLayerPassword->setEnabled( i < mUri.size() && mUri[i].startsWith( "PG:" ) && !mUri[i].contains( "password=" ) );
mLayerPassword->setEnabled( i < mUri.size() && mUri.value( i ).startsWith( "PG:" ) && !mUri.value( i ).contains( "password=" ) );
}

QgsGrassModuleGdalInput::~QgsGrassModuleGdalInput()
@@ -2028,7 +2026,7 @@ void QgsGrassModuleFile::browse()

QString QgsGrassModuleFile::ready()
{
QgsDebugMsg( "called." );
QgsDebugMsg( "key = " + key() );

QString error;
QString path = mLineEdit->text().trimmed();
@@ -440,19 +440,19 @@ class QgsGrassModuleGdalInput : public QgsGrassModuleGroupBoxItem
Q_OBJECT

public:
enum Type { Gdal, Ogr };

/** \brief Constructor
* \param qdesc option element in QGIS module description XML file
* \param gdesc GRASS module XML description file
*/
QgsGrassModuleGdalInput( QgsGrassModule *module, int type, QString key,
QgsGrassModuleGdalInput( QgsGrassModule *module, QgsGrassModuleGdalInput::Type type, QString key,
QDomElement &qdesc, QDomElement &gdesc, QDomNode &gnode,
bool direct, QWidget * parent = 0 );

//! Destructor
~QgsGrassModuleGdalInput();

enum Type { Gdal, Ogr };

//! Reimplemented
QStringList options() override;
QString ready() override;

0 comments on commit b9f6d78

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