Skip to content

Commit 5cf0f65

Browse files
committed
try to fix the index out of bound for programlogger
1 parent 27313cd commit 5cf0f65

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

Plugins/Flow.Launcher.Plugin.Program/Logger/ProgramLogger.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -98,17 +98,17 @@ internal static void LogException(string classname, string callingMethodName, st
9898
internal static void LogException(string message, Exception e)
9999
{
100100
//Index 0 is always empty.
101-
var parts = message.Split('|');
101+
var parts = message.Split('|', StringSplitOptions.RemoveEmptyEntries);
102102
if (parts.Length < 4)
103103
{
104104
var logger = LogManager.GetLogger("");
105105
logger.Error(e, $"fail to log exception in program logger, parts length is too small: {parts.Length}, message: {message}");
106106
}
107107

108-
var classname = parts[1];
109-
var callingMethodName = parts[2];
110-
var loadingProgramPath = parts[3];
111-
var interpretationMessage = parts[4];
108+
var classname = parts[0];
109+
var callingMethodName = parts[1];
110+
var loadingProgramPath = parts[2];
111+
var interpretationMessage = parts[3];
112112

113113
LogException(classname, callingMethodName, loadingProgramPath, interpretationMessage, e);
114114
}

0 commit comments

Comments
 (0)