Browse Source

Do not try to access non-existen string index.

tags/v0.1.1^2
Rafal Kupiec 11 months ago
parent
commit
91887c0185
Signed by: belliash <belliash@codingworkshop.eu.org> GPG Key ID: 4E829243E0CFE6B4
1 changed files with 4 additions and 2 deletions
  1. +4
    -2
      tests/base32_test.aer

+ 4
- 2
tests/base32_test.aer View File

@@ -55,8 +55,10 @@ class Base32 {
if(!in_array($input[$i], Base32::$map))
return '';
for(int $j = 0; $j < 8; $j++) {
if(array_key_exists($input[$i + $j], Base32::$flippedMap)) {
$x += str_pad(base_convert(Base32::$flippedMap[$input[$i + $j]], 10, 2), 5, '0', STR_PAD_LEFT);
if($i + $j < strlen($input)) {
if(array_key_exists($input[$i + $j], Base32::$flippedMap)) {
$x += str_pad(base_convert(Base32::$flippedMap[$input[$i + $j]], 10, 2), 5, '0', STR_PAD_LEFT);
}
}
}
string[] $eightBits = str_split($x, 8);


Loading…
Cancel
Save