fix null pointer bug

This commit is contained in:
MaysWind
2020-12-05 20:07:08 +08:00
parent 0f56fe1525
commit a147191804
+2 -4
View File
@@ -67,13 +67,11 @@ func (s *TransactionCategoryService) GetCategoryByCategoryId(uid int64, category
if err != nil { if err != nil {
return nil, err return nil, err
} else if !has {
return nil, errs.ErrTransactionCategoryNotFound
} }
if has {
return category, nil return category, nil
} else {
return nil, nil
}
} }
func (s *TransactionCategoryService) GetCategoryAndSubCategoriesByCategoryId(uid int64, categoryId int64) ([]*models.TransactionCategory, error) { func (s *TransactionCategoryService) GetCategoryAndSubCategoriesByCategoryId(uid int64, categoryId int64) ([]*models.TransactionCategory, error) {