IndexOf fix

This commit is contained in:
Deantwo 2018-07-10 16:00:21 +02:00 committed by GitHub
parent 41412a8822
commit ad9cda09cb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -133,7 +133,7 @@ namespace AsterNET.Manager
// \n - because not all dev in Digium use \r\n // \n - because not all dev in Digium use \r\n
// .Trim() kill \r // .Trim() kill \r
lock (((ICollection) lineQueue).SyncRoot) lock (((ICollection) lineQueue).SyncRoot)
while (!string.IsNullOrEmpty(mrReader.lineBuffer) && (idx = mrReader.lineBuffer.IndexOf("\n")) >= 0) while (!string.IsNullOrEmpty(mrReader.lineBuffer) && (idx = mrReader.lineBuffer.IndexOf('\n')) >= 0)
{ {
line = idx > 0 ? mrReader.lineBuffer.Substring(0, idx).Trim() : string.Empty; line = idx > 0 ? mrReader.lineBuffer.Substring(0, idx).Trim() : string.Empty;
mrReader.lineBuffer = (idx + 1 < mrReader.lineBuffer.Length mrReader.lineBuffer = (idx + 1 < mrReader.lineBuffer.Length