mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-11-22 18:00:18 +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) {
|
||||
if (
|
||||
!request.params ||
|
||||
!request.params[0] ||
|
||||
typeof request.params[0] !== 'object' ||
|
||||
Array.isArray(request.params[0])
|
||||
) {
|
||||
@ -392,7 +393,7 @@ function getLastIndexOfObjectArray (array, key, value) {
|
||||
|
||||
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}`)
|
||||
}
|
||||
|
||||
|
@ -57,7 +57,7 @@ describe('Transaction Controller', function () {
|
||||
const exposedState = txController.getState()
|
||||
assert('unapprovedTxs' in exposedState, 'state should have the key unapprovedTxs')
|
||||
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')
|
||||
})
|
||||
})
|
||||
|
Loading…
Reference in New Issue
Block a user