X-Git-Url: https://code.delx.au/refind/blobdiff_plain/39f21d099c9fb310bae28b54dc68d266ed610ed7..119f040f3c096ef2ab59f5d02059e9d872047dcd:/refind/config.c diff --git a/refind/config.c b/refind/config.c index 63d0f31..12375c4 100644 --- a/refind/config.c +++ b/refind/config.c @@ -348,15 +348,16 @@ VOID ReadConfig(CHAR16 *FileName) if (StriCmp(FileName, CONFIG_FILE_NAME) == 0) { MyFreePool(GlobalConfig.AlsoScan); GlobalConfig.AlsoScan = StrDuplicate(ALSO_SCAN_DIRS); -// MyFreePool(GlobalConfig.DontScanVolumes); -// GlobalConfig.DontScanVolumes = StrDuplicate(L" "); MyFreePool(GlobalConfig.DontScanDirs); - if (SelfVolume->VolName) { - SelfPath = StrDuplicate(SelfVolume->VolName); - } else { - SelfPath = AllocateZeroPool(256 * sizeof(CHAR16)); - SPrint(SelfPath, 255, L"fs%d", SelfVolume->VolNumber); - } // if/else + if (SelfVolume) { + if (SelfVolume->VolName) { + SelfPath = StrDuplicate(SelfVolume->VolName); + } else { + SelfPath = AllocateZeroPool(256 * sizeof(CHAR16)); + if (SelfPath != NULL) + SPrint(SelfPath, 255, L"fs%d", SelfVolume->VolNumber); + } // if/else + } MergeStrings(&SelfPath, SelfDirPath, L':'); GlobalConfig.DontScanDirs = SelfPath; MyFreePool(GlobalConfig.DontScanFiles); @@ -424,11 +425,11 @@ VOID ReadConfig(CHAR16 *FileName) } else if ((StriCmp(TokenList[0], L"don't_scan_volumes") == 0) || (StriCmp(TokenList[0], L"dont_scan_volumes") == 0)) { HandleStrings(TokenList, TokenCount, &(GlobalConfig.AlsoScan)); // Note: Don't use HandleStrings() because it modifies slashes, which might be present in volume name - MyFreePool(GlobalConfig.DontScanVolumes); - GlobalConfig.DontScanVolumes = NULL; - for (i = 1; i < TokenCount; i++) { - MergeStrings(&GlobalConfig.DontScanVolumes, TokenList[i], L','); - } + MyFreePool(GlobalConfig.DontScanVolumes); + GlobalConfig.DontScanVolumes = NULL; + for (i = 1; i < TokenCount; i++) { + MergeStrings(&GlobalConfig.DontScanVolumes, TokenList[i], L','); + } } else if ((StriCmp(TokenList[0], L"don't_scan_dirs") == 0) || (StriCmp(TokenList[0], L"dont_scan_dirs") == 0)) { HandleStrings(TokenList, TokenCount, &(GlobalConfig.DontScanDirs));