Skip to content
Snippets Groups Projects
Commit 56a04886 authored by 卜木's avatar 卜木 Committed by 花裤衩
Browse files

prevent JSON.parse fault when search is undefined

parent ffd668fb
Branches
Tags
No related merge requests found
......@@ -110,7 +110,11 @@
export function param2Obj(url) {
const search = url.split('?')[1];
return JSON.parse('{"' + decodeURIComponent(search).replace(/"/g, '\\"').replace(/&/g, '","').replace(/=/g, '":"') + '"}')
if (search !== undefined) {
return JSON.parse('{"' + decodeURIComponent(search).replace(/"/g, '\\"').replace(/&/g, '","').replace(/=/g, '":"') + '"}');
}
return {};
}
export function html2Text(val) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment