Skip to content

Commit

Permalink
empty string handling for asciiToHex (#1196)
Browse files Browse the repository at this point in the history
  • Loading branch information
vibhumbhardwaj authored and frozeman committed Nov 27, 2017
1 parent e610f6c commit 74748a3
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 74748a3

Please sign in to comment.