Skip to content

Commit

Permalink
empty string handling for asciiToHex (web3#1196)
Browse files Browse the repository at this point in the history
  • Loading branch information
vibhumbhardwaj authored and nachomazzara committed Jun 4, 2020
1 parent 909f474 commit d9fe498
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions packages/web3-utils/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,8 @@ var hexToAscii = function(hex) {
* @returns {String} hex representation of input string
*/
var asciiToHex = function(str) {
if(!str)
return "0x00";
var hex = "";
for(var i = 0; i < str.length; i++) {
var code = str.charCodeAt(i);
Expand Down

0 comments on commit d9fe498

Please sign in to comment.