From d447236571dd672555bf159337a9aa91871d9394 Mon Sep 17 00:00:00 2001
From: Rodrigo Braz Monteiro <zeratul@cellosoft.com>
Date: Thu, 6 Mar 2008 19:57:14 +0000
Subject: [PATCH] Fixed issue #673, related to concatenation of null-timed
 lines.

Originally committed to SVN as r1924.
---
 aegisub/subs_grid.cpp | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/aegisub/subs_grid.cpp b/aegisub/subs_grid.cpp
index 02f402b01..56df1f233 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);
-- 
GitLab