(BugFix) Add guard type for modules (#1124)

* Add guards for modules

* Add guards for modules

* Update src/routes/safe/store/actions/fetchSafe.ts

Co-authored-by: Fernando <fernando.greco@gmail.com>

Co-authored-by: Fernando <fernando.greco@gmail.com>
This commit is contained in:
Agustin Pane 2020-07-20 13:17:33 -03:00 committed by GitHub
parent 57248c6985
commit 6ba98f4e8a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 3 deletions

View File

@ -39,8 +39,8 @@ const buildOwnersFrom = (
})
})
const buildModulesLinkedList = (modules: string[], nextModule: string): Array<ModulePair> | null => {
if (modules.length) {
const buildModulesLinkedList = (modules: string[] | undefined, nextModule: string): Array<ModulePair> | null => {
if (modules?.length) {
return modules.map((moduleAddress, index, modules) => {
const prevModule = modules[index + 1]
return [moduleAddress, prevModule !== undefined ? prevModule : nextModule]
@ -111,7 +111,7 @@ export const checkAndUpdateSafe = (safeAdd: string) => async (dispatch: Dispatch
dispatch(
addSafeModules({
safeAddress,
modulesAddresses: buildModulesLinkedList(modules.array, modules.next),
modulesAddresses: buildModulesLinkedList(modules?.array, modules?.next),
}),
)