aboutsummaryrefslogtreecommitdiffstats
path: root/lib/stdlib/src
diff options
context:
space:
mode:
authorJohn Högberg <[email protected]>2018-07-04 09:48:27 +0200
committerJohn Högberg <[email protected]>2018-07-04 09:48:27 +0200
commite4529b82e0f2980a8b3f4b961dc18ff1fdd43d8e (patch)
tree821c452aa4524b2bd4922fefd0f00eb9ac7ac396 /lib/stdlib/src
parent75e63dde39b73613cdb08bcb011a82a21d8707fc (diff)
parent1f55b15c5e3f6ff79c855963876c501e9f782406 (diff)
downloadotp-e4529b82e0f2980a8b3f4b961dc18ff1fdd43d8e.tar.gz
otp-e4529b82e0f2980a8b3f4b961dc18ff1fdd43d8e.tar.bz2
otp-e4529b82e0f2980a8b3f4b961dc18ff1fdd43d8e.zip
Merge branch 'maint-21' into maint
* maint-21: Updated OTP version Update release notes Update version numbers Eliminate a crash in the beam_jump pass stdlib: Fix a 'chars_limit' bug Fix a race condition when generating async operation ids Fix internal compiler error for map_get/2 beam_type: Fix unsafe optimization public_key: Remove moduli 5121 and 7167 Thoose were added by 598629aeba9de98e8cdf5637043eb34e5d407751 but are not universaly supported.
Diffstat (limited to 'lib/stdlib/src')
-rw-r--r--lib/stdlib/src/io_lib_pretty.erl12
1 files changed, 9 insertions, 3 deletions
diff --git a/lib/stdlib/src/io_lib_pretty.erl b/lib/stdlib/src/io_lib_pretty.erl
index dca1b37ef3..ba9d9e8434 100644
--- a/lib/stdlib/src/io_lib_pretty.erl
+++ b/lib/stdlib/src/io_lib_pretty.erl
@@ -722,7 +722,7 @@ printable_list(L, _D, T, latin1) when T < 0 ->
io_lib:printable_latin1_list(L);
printable_list(L, _D, T, Enc) when T >= 0 ->
case slice(L, tsub(T, 2)) of
- {prefix, ""} ->
+ false ->
false;
{prefix, Prefix} when Enc =:= latin1 ->
io_lib:printable_latin1_list(Prefix) andalso {true, Prefix};
@@ -738,11 +738,17 @@ printable_list(L, _D, T, _Uni) when T < 0->
io_lib:printable_list(L).
slice(L, N) ->
- case string:length(L) =< N of
+ try string:length(L) =< N of
true ->
all;
false ->
- {prefix, string:slice(L, 0, N)}
+ case string:slice(L, 0, N) of
+ "" ->
+ false;
+ Prefix ->
+ {prefix, Prefix}
+ end
+ catch _:_ -> false
end.
printable_bin0(Bin, D, T, Enc) ->