Don't fall over when looking at activities of a cloned empty repo.
This commit is contained in:
parent
e52f1b0af9
commit
ca6070b386
|
@ -110,14 +110,15 @@ namespace SparkleShare {
|
||||||
process.StartInfo.FileName = "git";
|
process.StartInfo.FileName = "git";
|
||||||
process.StartInfo.Arguments = "log --format=\"%at☃%an☃%ae☃%s\" -" + number_of_events;
|
process.StartInfo.Arguments = "log --format=\"%at☃%an☃%ae☃%s\" -" + number_of_events;
|
||||||
|
|
||||||
string output = "";
|
|
||||||
|
|
||||||
process.Start ();
|
process.Start ();
|
||||||
|
|
||||||
output += "\n" + process.StandardOutput.ReadToEnd ().Trim ();
|
string output = process.StandardOutput.ReadToEnd ().Trim ();
|
||||||
|
|
||||||
output = output.TrimStart ("\n".ToCharArray ());
|
output = output.TrimStart ("\n".ToCharArray ());
|
||||||
string [] lines = Regex.Split (output, "\n");
|
string [] lines = Regex.Split (output, "\n");
|
||||||
|
int linesLength = lines.Length;
|
||||||
|
if (output == "")
|
||||||
|
linesLength = 0;
|
||||||
|
|
||||||
// Sort by time and get the last 25
|
// Sort by time and get the last 25
|
||||||
Array.Sort (lines);
|
Array.Sort (lines);
|
||||||
|
@ -125,7 +126,7 @@ namespace SparkleShare {
|
||||||
|
|
||||||
List <ActivityDay> activity_days = new List <ActivityDay> ();
|
List <ActivityDay> activity_days = new List <ActivityDay> ();
|
||||||
|
|
||||||
for (int i = 0; i < number_of_events && i < lines.Length; i++) {
|
for (int i = 0; i < number_of_events && i < linesLength; i++) {
|
||||||
|
|
||||||
string line = lines [i];
|
string line = lines [i];
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue