Having a bool check inside a while like that is a bit of a code smell to me.  Better to make it more explicit.  

```
if ( validateIds && !mSelectedFeatureIds.empty() )
```