Skip to content
This repository has been archived by the owner on Feb 5, 2023. It is now read-only.

Commit

Permalink
fix(profile): fix lib size not calc correctly
Browse files Browse the repository at this point in the history
- Corrected a typo-caused size not loading problem.
  • Loading branch information
Andy-K-Sparklight committed Jan 21, 2023
1 parent 5acd94c commit c88eb74
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/core/profile/GameProfile.cc
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ Artifact::Artifact(const cJSON *src)
}

cJSON *sizeItem = cJSON_GetObjectItem(src, "size");
if(cJSON_IsNumber(sha1Item))
if(cJSON_IsNumber(sizeItem))
{
size = (size_t)cJSON_GetNumberValue(sizeItem);
}
Expand Down Expand Up @@ -142,6 +142,7 @@ Library::Library(const cJSON *src, bool checkReq)
auto parts = Commons::splitStr(name, ":");
isNative = parts.size() == 4; // If it has 4 parts
cJSON *urlItem = cJSON_GetObjectItem(src, "url");
cJSON *sizeItem = cJSON_GetObjectItem(src, "size");
std::string url;
if(cJSON_IsString(urlItem))
{
Expand All @@ -159,7 +160,7 @@ Library::Library(const cJSON *src, bool checkReq)
group = std::regex_replace(group, dot, "/");
artifact.path = group + "/" + proj + "/" + version + "/" + proj + "-"
+ version + ".jar";
artifact.size = 0;
artifact.size = 0; // Placeholder
artifact.sha1 = "";
artifact.url = url + group + "/" + proj + "/" + version + "/" + proj
+ "-" + version + ".jar";
Expand Down

0 comments on commit c88eb74

Please sign in to comment.