Skip to content

Commit

Permalink
Patch #1012
Browse files Browse the repository at this point in the history
  • Loading branch information
BartoszCichecki committed Nov 5, 2023
1 parent 3e80f27 commit 5c4c0f3
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion LenovoLegionToolkit.Lib/Controllers/PowerPlanController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ private static unsafe IEnumerable<Guid> GetPowerPlansGuid()

private static unsafe string GetPowerPlanName(Guid powerPlanGuid)
{
var nameSize = 1024u;
var nameSize = 2048u;
var namePtr = Marshal.AllocHGlobal((int)nameSize);

try
Expand All @@ -187,6 +187,10 @@ private static unsafe string GetPowerPlanName(Guid powerPlanGuid)

return Marshal.PtrToStringUni(namePtr) ?? string.Empty;
}
catch
{
return powerPlanGuid.ToString();
}
finally
{
Marshal.FreeHGlobal(namePtr);
Expand Down

0 comments on commit 5c4c0f3

Please sign in to comment.