mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 17:46:28 +08:00
ui: problemconfig: guard empty config load for js-yaml v5 (#1208)
This commit is contained in:
1 parent
67b605393c
commit
6635257ad0
1 file changed
+1
-1
@@ -21,7 +21,7 @@ export default function reducer(state = {
|
|||||||
case 'CONFIG_LOAD_FULFILLED': {
|
case 'CONFIG_LOAD_FULFILLED': {
|
||||||
const c = { ...state, __loaded: true };
|
const c = { ...state, __loaded: true };
|
||||||
try {
|
try {
|
||||||
let data = yaml.load(action.payload.config) as any;
|
let data = yaml.load(action.payload.config || '{}') as any;
|
||||||
if (typeof data !== 'object') data = { subtasks: [] };
|
if (typeof data !== 'object') data = { subtasks: [] };
|
||||||
else data.subtasks ||= [];
|
else data.subtasks ||= [];
|
||||||
if (!validate(data)) {
|
if (!validate(data)) {
|
||||||
|
|||||||
Reference in new issue
Block a user