mirror of https://github.com/halo-dev/halo
Fix NPE when importing markdown files
parent
084902c719
commit
bf6b11eb2e
|
@ -31,6 +31,7 @@ public interface TagService extends CrudService<Tag, Integer> {
|
|||
* @param name name
|
||||
* @return Tag
|
||||
*/
|
||||
@Nullable
|
||||
Tag getByName(@NonNull String name);
|
||||
|
||||
/**
|
||||
|
|
|
@ -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) {
|
||||
|
|
Loading…
Reference in New Issue