Allow empty dict

This commit is contained in:
jief666 2020-08-19 10:52:07 +03:00
parent 5b1eea4df0
commit 2ef2b9df0d
2 changed files with 11 additions and 10 deletions

View File

@ -510,7 +510,7 @@ LoadUserSettings (
{
EFI_STATUS Status = EFI_NOT_FOUND;
UINTN Size = 0;
CHAR8* gConfigPtr = NULL;
CHAR8* ConfigPtr = NULL;
XStringW ConfigPlistPath;
XStringW ConfigOemPath;
@ -524,16 +524,16 @@ LoadUserSettings (
ConfigPlistPath = SWPrintf("EFI\\CLOVER\\%ls.plist", ConfName.wc_str());
ConfigOemPath = SWPrintf("%ls\\%ls.plist", OEMPath.wc_str(), ConfName.wc_str());
if (FileExists (SelfRootDir, ConfigOemPath)) {
Status = egLoadFile(SelfRootDir, ConfigOemPath.wc_str(), (UINT8**)&gConfigPtr, &Size);
Status = egLoadFile(SelfRootDir, ConfigOemPath.wc_str(), (UINT8**)&ConfigPtr, &Size);
}
if (EFI_ERROR(Status)) {
if ((RootDir != NULL) && FileExists (RootDir, ConfigPlistPath)) {
Status = egLoadFile(RootDir, ConfigPlistPath.wc_str(), (UINT8**)&gConfigPtr, &Size);
Status = egLoadFile(RootDir, ConfigPlistPath.wc_str(), (UINT8**)&ConfigPtr, &Size);
}
if (!EFI_ERROR(Status)) {
DBG("Using %ls.plist at RootDir at path: %ls\n", ConfName.wc_str(), ConfigPlistPath.wc_str());
} else {
Status = egLoadFile(SelfRootDir, ConfigPlistPath.wc_str(), (UINT8**)&gConfigPtr, &Size);
Status = egLoadFile(SelfRootDir, ConfigPlistPath.wc_str(), (UINT8**)&ConfigPtr, &Size);
if (!EFI_ERROR(Status)) {
DBG("Using %ls.plist at SelfRootDir at path: %ls\n", ConfName.wc_str(), ConfigPlistPath.wc_str());
}else{
@ -544,8 +544,8 @@ LoadUserSettings (
DBG("Using %ls.plist at SelfRootDir at path: %ls\n", ConfName.wc_str(), ConfigOemPath.wc_str());
}
if (!EFI_ERROR(Status) && gConfigPtr != NULL) {
Status = ParseXML((const CHAR8*)gConfigPtr, Dict, (UINT32)Size);
if (!EFI_ERROR(Status) && ConfigPtr != NULL) {
Status = ParseXML((const CHAR8*)ConfigPtr, Dict, (UINT32)Size);
if (EFI_ERROR(Status)) {
// Dict = NULL;
DBG("config.plist parse error Status=%s\n", strerror(Status));

View File

@ -116,7 +116,7 @@ public:
}
void setDataValue(UINT8* data, UINTN dataLen)
{
if ( data == NULL ) panic("TagStruct::setDictValue() : _data == NULL ");
if ( data == NULL ) panic("TagStruct::setDataValue() : _data == NULL ");
_data = data;
_dataLen = dataLen;
type = kTagTypeData;
@ -141,9 +141,10 @@ public:
}
void setDictTagValue(TagStruct* tagList)
{
if ( tagList == NULL ) panic("TagStruct::setDictValue() : tagList == NULL ");
if ( _tag != NULL ) panic("TagStruct::setDictValue() : _tag != NULL ");
if ( _nextTag != NULL ) panic("TagStruct::setDictValue() : _nextTag != NULL ");
// empty dict is allowed
//if ( tagList == NULL ) panic("TagStruct::setDictTagValue() : tagList == NULL ");
if ( _tag != NULL ) panic("TagStruct::setDictTagValue() : _tag != NULL ");
if ( _nextTag != NULL ) panic("TagStruct::setDictTagValue() : _nextTag != NULL ");
_tag = tagList;
_nextTag = NULL;
type = kTagTypeDict;