diff --git a/routers/api/v1/repo/topic.go b/routers/api/v1/repo/topic.go
index 1cc2c50dc2..64dc763dc3 100644
--- a/routers/api/v1/repo/topic.go
+++ b/routers/api/v1/repo/topic.go
@@ -240,6 +240,7 @@ func DeleteTopic(ctx *context.APIContext) {
 
 	if topic == nil {
 		ctx.NotFound()
+		return
 	}
 
 	ctx.Status(http.StatusNoContent)