From 19a716e7da3ac8ec5867cc85b7e93d439f77d7e0 Mon Sep 17 00:00:00 2001 From: Erik Johnston Date: Sat, 18 Nov 2017 15:06:51 +0000 Subject: [PATCH] Fix create filter API (#342) --- .../dendrite/clientapi/auth/storage/accounts/filter_table.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/github.com/matrix-org/dendrite/clientapi/auth/storage/accounts/filter_table.go b/src/github.com/matrix-org/dendrite/clientapi/auth/storage/accounts/filter_table.go index 9e3b7d6e..81bae454 100644 --- a/src/github.com/matrix-org/dendrite/clientapi/auth/storage/accounts/filter_table.go +++ b/src/github.com/matrix-org/dendrite/clientapi/auth/storage/accounts/filter_table.go @@ -92,11 +92,11 @@ func (s *filterStatements) insertFilter( // Check if filter already exists in the database err = s.selectFilterIDByContentStmt.QueryRowContext(ctx, localpart, filterJSON).Scan(&existingFilterID) - if err != nil { + if err != nil && err != sql.ErrNoRows { return "", err } // If it does, return the existing ID - if len(existingFilterID) != 0 { + if existingFilterID != "" { return existingFilterID, err }