Skip to content

Commit

Permalink
Fixed broken decode method when None value is passed. (dbcli#287)
Browse files Browse the repository at this point in the history
  • Loading branch information
Gene Lee authored Sep 11, 2019
1 parent 86ae722 commit 0db7f76
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions utility.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ def copy_current_platform_mssqltoolsservice():


def encode(s):
if (sys.version_info.major < 3):
if (s is not None and sys.version_info.major < 3):
return s.encode('utf-8')
return s

Expand All @@ -92,7 +92,7 @@ def encode(s):
# There is a bytes type that holds raw bytes.
# In Python 2, a string may be of type str or of type unicode.
def decode(s):
if (sys.version_info.major < 3):
if (s is not None and sys.version_info.major < 3):
return s.decode('utf-8')
return s

Expand Down

0 comments on commit 0db7f76

Please sign in to comment.