Browse Source

Merge pull request #1813 from slingamn/message_error

CHATHISTORY with nonexistent msgid should send empty batch
tags/v2.8.0-rc1
Shivaram Lingamneni 2 years ago
parent
commit
7e93770540
No account linked to committer's email address
1 changed files with 10 additions and 2 deletions
  1. 10
    2
      irc/mysql/history.go

+ 10
- 2
irc/mysql/history.go View File

@@ -1043,14 +1043,22 @@ func (s *mySQLHistorySequence) Between(start, end history.Selector, limit int) (
1043 1043
 	if start.Msgid != "" {
1044 1044
 		startTime, _, _, err = s.mysql.lookupMsgid(ctx, start.Msgid, false)
1045 1045
 		if err != nil {
1046
-			return nil, err
1046
+			if err == sql.ErrNoRows {
1047
+				return nil, nil
1048
+			} else {
1049
+				return nil, err
1050
+			}
1047 1051
 		}
1048 1052
 	}
1049 1053
 	endTime := end.Time
1050 1054
 	if end.Msgid != "" {
1051 1055
 		endTime, _, _, err = s.mysql.lookupMsgid(ctx, end.Msgid, false)
1052 1056
 		if err != nil {
1053
-			return nil, err
1057
+			if err == sql.ErrNoRows {
1058
+				return nil, nil
1059
+			} else {
1060
+				return nil, err
1061
+			}
1054 1062
 		}
1055 1063
 	}
1056 1064
 

Loading…
Cancel
Save