Skip to content

Commit

Permalink
Ensure typedSignatureHash receives a non-empty array
Browse files Browse the repository at this point in the history
  • Loading branch information
KiChjang committed Jan 10, 2020
1 parent 09551b2 commit 36c4a01
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -531,7 +531,7 @@ export {
*/
function typedSignatureHash<T extends MessageTypes>(typedData: TypedData<T>): Buffer {
const error = new Error('Expect argument to be non-empty array')
if (typeof typedData !== 'object' || !('length' in typedData)) throw error
if (typeof typedData !== 'object' || !('length' in typedData) || !typedData.length) throw error

const data = typedData.map(function (e) {
return e.type === 'bytes' ? ethUtil.toBuffer(e.value) : e.value
Expand Down

0 comments on commit 36c4a01

Please sign in to comment.