Skip to content

Commit

Permalink
add empty program check
Browse files Browse the repository at this point in the history
  • Loading branch information
ahangsu committed Aug 24, 2022
1 parent 0607aaf commit b18f6f7
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
3 changes: 3 additions & 0 deletions algosdk/logic.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ def is_ascii_printable(program_bytes):
)
)

if program is None or len(program) == 0:
raise error.InvalidProgram("empty program")

if is_ascii_printable(program):
try:
encoding.decode_address(program.decode("utf-8"))
Expand Down
2 changes: 1 addition & 1 deletion tests/steps/steps.py
Original file line number Diff line number Diff line change
Expand Up @@ -997,7 +997,7 @@ def buildTxn(t, sender, params):


@given(
'a base64 encoded program bytes for heuristic sanity check "{b64encoded}"'
'a base64 encoded program bytes for heuristic sanity check "{b64encoded:MaybeString}"'
)
def take_b64_encoded_bytes(context, b64encoded):
context.seemingly_program = base64.b64decode(b64encoded)
Expand Down

0 comments on commit b18f6f7

Please sign in to comment.