Fix NPE when importing markdown files

pull/172/head
johnniang 2019-05-30 14:34:11 +08:00
parent 084902c719
commit bf6b11eb2e
2 changed files with 3 additions and 1 deletions

View File

@ -31,6 +31,7 @@ public interface TagService extends CrudService<Tag, Integer> {
* @param name name
* @return Tag
*/
@Nullable
Tag getByName(@NonNull String name);
/**

View File

@ -16,6 +16,7 @@ import run.halo.app.repository.CategoryRepository;
import run.halo.app.service.CategoryService;
import run.halo.app.service.PostCategoryService;
import run.halo.app.service.base.AbstractCrudService;
import run.halo.app.utils.ServiceUtils;
import java.util.Collections;
import java.util.LinkedList;
@ -56,7 +57,7 @@ public class CategoryServiceImpl extends AbstractCrudService<Category, Integer>
}
// Check parent id
if (category.getParentId() > 0) {
if (!ServiceUtils.isEmptyId(category.getParentId())) {
count = categoryRepository.countById(category.getParentId());
if (count == 0) {