mirror of
https://bitbucket.org/wisemapping/wisemapping-frontend.git
synced 2024-11-15 11:37:57 +01:00
Fix NPE error
This commit is contained in:
parent
9e63d7e6a9
commit
ea01716ed6
@ -47,12 +47,15 @@ export const fetchMapById = (id: number): MapLoadResult => {
|
|||||||
return client.fetchAllMaps();
|
return client.fetchAllMaps();
|
||||||
});
|
});
|
||||||
|
|
||||||
// Sanitize error structure ...
|
|
||||||
let errorMsg: ErrorInfo = Object.keys(error).length !== 0 ? error : null;
|
|
||||||
|
|
||||||
// If the map can not be loaded, create an error object.
|
// If the map can not be loaded, create an error object.
|
||||||
let map: MapInfo;
|
let map: MapInfo;
|
||||||
|
let errorMsg: ErrorInfo;
|
||||||
if (!isLoading) {
|
if (!isLoading) {
|
||||||
|
// Sanitize error structure ...
|
||||||
|
if (error) {
|
||||||
|
errorMsg = Object.keys(error).length !== 0 ? error : null;
|
||||||
|
}
|
||||||
|
// Seach for object...
|
||||||
map = data?.find((m) => m.id == id);
|
map = data?.find((m) => m.id == id);
|
||||||
if (map === null && !errorMsg) {
|
if (map === null && !errorMsg) {
|
||||||
errorMsg = { msg: `Map with id ${id} could not be found. Please, reflesh the page` }
|
errorMsg = { msg: `Map with id ${id} could not be found. Please, reflesh the page` }
|
||||||
|
Loading…
Reference in New Issue
Block a user