From 9a3db87516ece5a653612d886d16c9d5dea4e6ae Mon Sep 17 00:00:00 2001 From: alcexhim Date: Sun, 20 Apr 2014 16:36:26 -0400 Subject: [PATCH] Make sure Remaining doesn't return a negative value --- CSharp/Libraries/UniversalEditor.Core/Accessor.cs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/CSharp/Libraries/UniversalEditor.Core/Accessor.cs b/CSharp/Libraries/UniversalEditor.Core/Accessor.cs index 50814348..a7342b0d 100644 --- a/CSharp/Libraries/UniversalEditor.Core/Accessor.cs +++ b/CSharp/Libraries/UniversalEditor.Core/Accessor.cs @@ -21,7 +21,15 @@ namespace UniversalEditor private long mvarPosition = 0; public virtual long Position { get { return mvarPosition; } set { mvarPosition = value; Seek(mvarPosition, SeekOrigin.Begin); } } - public long Remaining { get { return Length - Position; } } + public long Remaining + { + get + { + long r = Length - Position; + if (r <= 0) return 0; + return r; + } + } public void Seek(int length, SeekOrigin position) {