diff --git a/aegisub/subs_grid.cpp b/aegisub/subs_grid.cpp
index 02f402b01e9468c3d27d68e89308dae11781e1ea..56df1f2330eed289fbcb424f5bfd17acc193aaed 100644
--- a/aegisub/subs_grid.cpp
+++ b/aegisub/subs_grid.cpp
@@ -1052,6 +1052,7 @@ void SubtitlesGrid::JoinLines(int n1,int n2,bool concat) {
 	AssDialogue *cur;
 	int start,end;
 	bool gotfirst = false;
+	bool gottime = false;
 	for (int i=n1;i<=n2;i++) {
 		// Get start and end time of current line
 		cur = GetDialogue(i);
@@ -1062,6 +1063,7 @@ void SubtitlesGrid::JoinLines(int n1,int n2,bool concat) {
 		if (start != 0 || end != 0) {
 			if (start < min_ms) min_ms = start;
 			if (end > max_ms) max_ms = end;
+			gottime = true;
 		}
 
 		// Set text
@@ -1072,6 +1074,12 @@ void SubtitlesGrid::JoinLines(int n1,int n2,bool concat) {
 		}
 	}
 
+	// If it didn't get any times, then it's probably because they were all 0 lines.
+	if (!gottime) {
+		min_ms = 0;
+		max_ms = 0;
+	}
+
 	// Apply settings to first line
 	cur = GetDialogue(n1);
 	cur->Start.SetMS(min_ms);