From 7951eb69baa0b4c5a0328a6bb550d0ec10a0d54e Mon Sep 17 00:00:00 2001 From: asava Date: Tue, 14 Apr 2020 09:51:00 +0300 Subject: [PATCH] Exclude redundant calls to LoadXImage in Linux Scan --- rEFIt_UEFI/entry_scan/loader.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/rEFIt_UEFI/entry_scan/loader.cpp b/rEFIt_UEFI/entry_scan/loader.cpp index 9c63064db..269df74e3 100644 --- a/rEFIt_UEFI/entry_scan/loader.cpp +++ b/rEFIt_UEFI/entry_scan/loader.cpp @@ -1254,11 +1254,13 @@ VOID ScanLoader(VOID) if (gSettings.LinuxScan) { // check for linux loaders for (Index = 0; Index < LinuxEntryDataCount; ++Index) { - XImage ImageX; - XStringW IconXSW = XStringW().takeValueFrom(LinuxEntryData[Index].Icon); - ImageX.LoadXImage(ThemeX.ThemeDir, (L"os_"_XSW + IconXSW.SubString(0, IconXSW.IdxOf(','))).wc_str()); - AddLoaderEntry(LinuxEntryData[Index].Path, ""_XS, XStringW().takeValueFrom(LinuxEntryData[Index].Title), Volume, - (ImageX.isEmpty() ? NULL : &ImageX), OSTYPE_LIN, OSFLAG_NODEFAULTARGS); + if (FileExists(Volume->RootDir, LinuxEntryData[Index].Path)) { + XImage ImageX; + XStringW IconXSW = XStringW().takeValueFrom(LinuxEntryData[Index].Icon); + ImageX.LoadXImage(ThemeX.ThemeDir, (L"os_"_XSW + IconXSW.SubString(0, IconXSW.IdxOf(','))).wc_str()); + AddLoaderEntry(LinuxEntryData[Index].Path, ""_XS, XStringW().takeValueFrom(LinuxEntryData[Index].Title), Volume, + (ImageX.isEmpty() ? NULL : &ImageX), OSTYPE_LIN, OSFLAG_NODEFAULTARGS); + } } // check for linux kernels PartGUID = FindGPTPartitionGuidInDevicePath(Volume->DevicePath);