ArtemIzmaylov / aimp_VK

VK Plugin for AIMP
Mozilla Public License 2.0
13 stars 6 forks source link

Текущая реализация ParseOwnerAndAudioIDPair приводит к ошибке IndexOutOfBounds. #1

Closed ArtemIzmaylov closed 2 years ago

ArtemIzmaylov commented 2 years ago

Вот корректная версия:

uses System.StrUtils, System.Types;

function ParseOwnerAndAudioIDPair(const S: string; out AOwnerID, ID: Integer; out AccessKey: String): Boolean; var AParts: TStringDynArray; begin AParts := SplitString(S, '_'); Result := Length(AParts) >= 2; if Result then begin AOwnerID := StrToIntDef(AParts[0], 0); ID := StrToIntDef(AParts[1], 0); if Length(AParts) >= 3 then AccessKey := AParts[2]; Result := (AOwnerID <> 0) and (ID <> 0); end; end;