mirror of
https://github.com/taurusxin/ncmdump.git
synced 2025-07-13 21:12:10 +08:00
fix: exception when artist is empty
This commit is contained in:
parent
d73e8c603c
commit
bb75e3e6f5
14
ncmcrypt.cpp
14
ncmcrypt.cpp
@ -94,12 +94,18 @@ NeteaseMusicMetadata::NeteaseMusicMetadata(cJSON *raw)
|
||||
artistLen = cJSON_GetArraySize(swap);
|
||||
|
||||
i = 0;
|
||||
for (i = 0; i < artistLen - 1; i++)
|
||||
for (i = 0; i < artistLen; i++)
|
||||
{
|
||||
mArtist += std::string(cJSON_GetStringValue(cJSON_GetArrayItem(cJSON_GetArrayItem(swap, i), 0)));
|
||||
mArtist += "/";
|
||||
auto artist = cJSON_GetArrayItem(swap, i);
|
||||
if (cJSON_GetArraySize(artist) > 0)
|
||||
{
|
||||
if (!mArtist.empty())
|
||||
{
|
||||
mArtist += "/";
|
||||
}
|
||||
mArtist += std::string(cJSON_GetStringValue(cJSON_GetArrayItem(artist, 0)));
|
||||
}
|
||||
}
|
||||
mArtist += std::string(cJSON_GetStringValue(cJSON_GetArrayItem(cJSON_GetArrayItem(swap, i), 0)));
|
||||
}
|
||||
|
||||
swap = cJSON_GetObjectItem(raw, "bitrate");
|
||||
|
Loading…
Reference in New Issue
Block a user