Skip to content

Commit 311a93d

Browse files
committed
Fix crash
1 parent 8ab8308 commit 311a93d

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

src/gleam_stdlib.erl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,7 @@ regex_scan(Regex, String) ->
255255

256256
base_decode64(S) ->
257257
try {ok, base64:decode(S)}
258-
catch error:badarith -> {error, nil}
258+
catch error:_ -> {error, nil}
259259
end.
260260

261261
wrap_list(X) when is_list(X) -> X;

test/gleam/base_test.gleam

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,3 +80,9 @@ pub fn url_decode64_test() {
8080
|> base.url_decode64()
8181
|> should.equal(Error(Nil))
8282
}
83+
84+
pub fn decode64_crash_regression_1_test() {
85+
"aGktdGhlcmU.uWUWvrAleKQ2jsWcU97H-RPJ5qRRcE_s"
86+
|> base.decode64()
87+
|> should.equal(Error(Nil))
88+
}

0 commit comments

Comments
 (0)