[mono/monkeywrench] 02d27d9c: Fix ArgumentOutOfRangeException when colorzing diffs.

"Rolf Bjarne Kvinge ([email protected])" <[email protected]>
Newsgroups gmane.comp.gnome.mono.patches
Message-ID <000001419cf07a6d-ff2ec34f-c35a-4fe2-8bc7-bc5bd1416a39-000000@email.amazonses.com>
   Branch: refs/heads/master
     Home: https://github.com/mono/monkeywrench
  Compare: https://github.com/mono/monkeywrench/compare/308d3d3ef3f0...02d27d9cf9f0

   Commit: 02d27d9cf9f09c6f856ed6848d6f5862e8385ff5
   Author: Rolf Bjarne Kvinge <[email protected]> (rolfbjarne)
     Date: 2013-10-09 11:16:57 GMT
      URL: https://github.com/mono/monkeywrench/commit/02d27d9cf9f09c6f856ed6848d6f5862e8385ff5

Fix ArgumentOutOfRangeException when colorzing diffs.

Changed paths:
  M MonkeyWrench.Web.UI/GetRevisionLog.aspx.cs

Modified: MonkeyWrench.Web.UI/GetRevisionLog.aspx.cs
===================================================================
@@ -96,8 +96,10 @@ private string ParseGitDiff (string diff)
 				} else if (line.StartsWith ("@@")) {
 					// line numbers
 					string [] nl = line.Replace ("@@", "").Trim ().Split (' ');
-					old_ln = int.Parse (nl [0].Substring (1, nl [0].IndexOf (',') - 1));
-					new_ln = int.Parse (nl [1].Substring (1, nl [1].IndexOf (',') - 1));
+					var oldc = nl [0].IndexOf (',');
+					var newc = nl [1].IndexOf (',');
+					old_ln = int.Parse (nl [0].Substring (1, oldc > 0 ? oldc - 1 : nl [0].Length - 1));
+					new_ln = int.Parse (nl [1].Substring (1, newc > 0 ? newc - 1 : nl [1].Length - 1));
 					result.AppendFormat ("<tr><td class='diff_view_line_number'><pre class='diff_view_pre'>&nbsp;</pre></td><td class='diff_view_line_number'><pre class='diff_view_pre'>&nbsp;</pre></td><td class='diff_view_at_td'><pre class='diff_view_pre'>{0}</pre></td></tr>\n", line);
 				} else {
 					string cl;



_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.