mirror of
https://github.com/microsoft/PowerToys.git
synced 2024-12-11 17:59:28 +08:00
[PT Run][Registry] handle invalid base keys (#13284)
This commit is contained in:
parent
2c44cc9cd2
commit
c6a24b3907
@ -86,12 +86,8 @@ namespace Microsoft.PowerToys.Run.Plugin.Registry
|
|||||||
// no base key found
|
// no base key found
|
||||||
return ResultHelper.GetResultList(RegistryHelper.GetAllBaseKeys(), _defaultIconPath);
|
return ResultHelper.GetResultList(RegistryHelper.GetAllBaseKeys(), _defaultIconPath);
|
||||||
}
|
}
|
||||||
else if (baseKeyList.Count() > 1)
|
else if (baseKeyList.Count() == 1)
|
||||||
{
|
{
|
||||||
// more than one base key was found -> show results
|
|
||||||
return ResultHelper.GetResultList(baseKeyList.Select(found => new RegistryEntry(found)), _defaultIconPath);
|
|
||||||
}
|
|
||||||
|
|
||||||
// only one base key was found -> start search for the sub-key
|
// only one base key was found -> start search for the sub-key
|
||||||
var list = RegistryHelper.SearchForSubKey(baseKeyList.First(), subKey);
|
var list = RegistryHelper.SearchForSubKey(baseKeyList.First(), subKey);
|
||||||
|
|
||||||
@ -104,6 +100,14 @@ namespace Microsoft.PowerToys.Run.Plugin.Registry
|
|||||||
|
|
||||||
return ResultHelper.GetResultList(list, _defaultIconPath);
|
return ResultHelper.GetResultList(list, _defaultIconPath);
|
||||||
}
|
}
|
||||||
|
else if (baseKeyList.Count() > 1)
|
||||||
|
{
|
||||||
|
// more than one base key was found -> show results
|
||||||
|
return ResultHelper.GetResultList(baseKeyList.Select(found => new RegistryEntry(found)), _defaultIconPath);
|
||||||
|
}
|
||||||
|
|
||||||
|
return new List<Result>();
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Return a list context menu entries for a given <see cref="Result"/> (shown at the right side of the result)
|
/// Return a list context menu entries for a given <see cref="Result"/> (shown at the right side of the result)
|
||||||
|
Loading…
Reference in New Issue
Block a user