File tree 1 file changed +18
-6
lines changed
1 file changed +18
-6
lines changed Original file line number Diff line number Diff line change @@ -2439,15 +2439,19 @@ std::vector<QgsField> QgsGrassModuleInput::currentFields()
2439
2439
{
2440
2440
QgsDebugMsg ( " called." );
2441
2441
2442
+ int limit = 0 ;
2443
+ if (!mRequired )
2444
+ limit = 1 ;
2445
+
2442
2446
std::vector<QgsField> fields;
2443
2447
2444
2448
int c = mLayerComboBox ->currentIndex ();
2445
- if ( c < 0 )
2449
+ if ( c < limit )
2446
2450
return fields;
2447
2451
2448
2452
unsigned current = c;
2449
2453
2450
- if ( current >= 0 && current < mVectorFields .size () )
2454
+ if ( current >= limit && current < mVectorFields .size () )
2451
2455
{
2452
2456
fields = mVectorFields [current];
2453
2457
}
@@ -2459,13 +2463,17 @@ QgsMapLayer * QgsGrassModuleInput::currentLayer()
2459
2463
{
2460
2464
QgsDebugMsg ( " called." );
2461
2465
2466
+ int limit = 0 ;
2467
+ if (!mRequired )
2468
+ limit = 1 ;
2469
+
2462
2470
int c = mLayerComboBox ->currentIndex ();
2463
- if ( c < 0 )
2471
+ if ( c < limit )
2464
2472
return 0 ;
2465
2473
2466
2474
unsigned int current = c;
2467
2475
2468
- if ( current >= 0 && current < mMapLayers .size () )
2476
+ if ( current >= limit && current < mMapLayers .size () )
2469
2477
{
2470
2478
return mMapLayers [current];
2471
2479
}
@@ -2477,13 +2485,17 @@ QString QgsGrassModuleInput::currentMap()
2477
2485
{
2478
2486
QgsDebugMsg ( " called." );
2479
2487
2488
+ int limit = 0 ;
2489
+ if (!mRequired )
2490
+ limit = 1 ;
2491
+
2480
2492
int c = mLayerComboBox ->currentIndex ();
2481
- if ( c < 0 )
2493
+ if ( c < limit )
2482
2494
return QString ();
2483
2495
2484
2496
unsigned int current = c;
2485
2497
2486
- if ( current >= 0 && current < mMaps .size () )
2498
+ if ( current >= limit && current < mMaps .size () )
2487
2499
{
2488
2500
return mMaps [current];
2489
2501
}
You can’t perform that action at this time.
0 commit comments