# PluginDirectoryScanner::getNextPluginFileThatWillBeScanned()

**URL:** <https://forum.juce.com/t/plugindirectoryscanner-getnextpluginfilethatwillbescanned/47277>\
**Category:** Audio Plugins\
**Created:** [August 10, 2021, 3:32pm UTC](https://forum.juce.com/t/plugindirectoryscanner-getnextpluginfilethatwillbescanned/47277 "2021-08-10T15:32:58Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![peteatjuce](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/peteatjuce/32/2347_2.png) [@peteatjuce](https://forum.juce.com/u/peteatjuce)\
**Post date:** [August 10, 2021, 3:32pm UTC](https://forum.juce.com/t/plugindirectoryscanner-getnextpluginfilethatwillbescanned/47277/1 "2021-08-10T15:32:58Z")

</div>

Suggested change to this - to prevent potential crash!

```auto
String PluginDirectoryScanner::getNextPluginFileThatWillBeScanned() const
  {
    // Ensure index in range!
    auto theIndex = nextIndex.get();
    if (theIndex == 0) {
        return "";
    }
    theIndex -= 1;

    return format.getNameOfPluginFromIdentifier (filesOrIdentifiersToScan [theIndex]);
}

```

HTH! Pete
