2893 |
if (!pSamples || !pSamples->size()) throw gig::Exception("Could not delete sample as there are no samples"); |
if (!pSamples || !pSamples->size()) throw gig::Exception("Could not delete sample as there are no samples"); |
2894 |
SampleList::iterator iter = find(pSamples->begin(), pSamples->end(), (DLS::Sample*) pSample); |
SampleList::iterator iter = find(pSamples->begin(), pSamples->end(), (DLS::Sample*) pSample); |
2895 |
if (iter == pSamples->end()) throw gig::Exception("Could not delete sample, could not find given sample"); |
if (iter == pSamples->end()) throw gig::Exception("Could not delete sample, could not find given sample"); |
2896 |
|
if (SamplesIterator != pSamples->end() && *SamplesIterator == pSample) ++SamplesIterator; // avoid iterator invalidation |
2897 |
pSamples->erase(iter); |
pSamples->erase(iter); |
2898 |
delete pSample; |
delete pSample; |
2899 |
} |
} |