mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-23 09:52:26 +01:00
fix faulty null checks
This commit is contained in:
parent
1ae0933897
commit
0103bf8b29
@ -325,6 +325,7 @@ export default class PermissionsLogController {
|
|||||||
getRequestedMethods (request) {
|
getRequestedMethods (request) {
|
||||||
if (
|
if (
|
||||||
!request.params ||
|
!request.params ||
|
||||||
|
!request.params[0] ||
|
||||||
typeof request.params[0] !== 'object' ||
|
typeof request.params[0] !== 'object' ||
|
||||||
Array.isArray(request.params[0])
|
Array.isArray(request.params[0])
|
||||||
) {
|
) {
|
||||||
@ -392,7 +393,7 @@ function getLastIndexOfObjectArray (array, key, value) {
|
|||||||
|
|
||||||
for (let i = array.length - 1; i >= 0; i--) {
|
for (let i = array.length - 1; i >= 0; i--) {
|
||||||
|
|
||||||
if (typeof array[i] !== 'object') {
|
if (!array[i] || typeof array[i] !== 'object') {
|
||||||
throw new Error(`Encountered non-Object element at index ${i}`)
|
throw new Error(`Encountered non-Object element at index ${i}`)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -57,7 +57,7 @@ describe('Transaction Controller', function () {
|
|||||||
const exposedState = txController.getState()
|
const exposedState = txController.getState()
|
||||||
assert('unapprovedTxs' in exposedState, 'state should have the key unapprovedTxs')
|
assert('unapprovedTxs' in exposedState, 'state should have the key unapprovedTxs')
|
||||||
assert('selectedAddressTxList' in exposedState, 'state should have the key selectedAddressTxList')
|
assert('selectedAddressTxList' in exposedState, 'state should have the key selectedAddressTxList')
|
||||||
assert(typeof exposedState.unapprovedTxs === 'object', 'should be an object')
|
assert(exposedState && typeof exposedState.unapprovedTxs === 'object', 'should be an object')
|
||||||
assert(Array.isArray(exposedState.selectedAddressTxList), 'should be an array')
|
assert(Array.isArray(exposedState.selectedAddressTxList), 'should be an array')
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
Loading…
x
Reference in New Issue
Block a user