Fixed a few issues reported by UBSan.

This commit is contained in:
Leon Styhre 2021-11-16 22:03:34 +01:00
parent c5c7835dbb
commit 4c6bfb8b78
4 changed files with 25 additions and 7 deletions

View file

@ -907,10 +907,11 @@ std::vector<std::string> CollectionSystemsManager::getUnusedSystemsFromTheme()
SystemData* CollectionSystemsManager::addNewCustomCollection(const std::string& name)
{
CollectionSystemDecl decl = mCollectionSystemDeclsIndex[myCollectionsName];
CollectionSystemDecl decl = {mCollectionSystemDeclsIndex[myCollectionsName]};
decl.themeFolder = name;
decl.name = name;
decl.fullName = name;
decl.isCustom = true;
return createNewCollectionEntry(name, decl, true, true);
}

View file

@ -49,6 +49,13 @@ struct CollectionSystemDecl {
};
struct CollectionSystemData {
CollectionSystemData()
: system{nullptr}
, decl{}
, isEnabled{false}
, isPopulated{false}
{
}
SystemData* system;
CollectionSystemDecl decl;
bool isEnabled;

View file

@ -42,6 +42,11 @@ struct ScraperSearchParams {
struct ScraperSearchResult {
ScraperSearchResult()
: mdl(GAME_METADATA)
, scraperRequestAllowance{0}
, mediaURLFetch{NOT_STARTED}
, thumbnailDownloadStatus{NOT_STARTED}
, mediaFilesDownloadStatus{NOT_STARTED}
, savedNewMedia{false}
{
}
@ -52,9 +57,9 @@ struct ScraperSearchResult {
// within a given time period.
unsigned int scraperRequestAllowance;
enum downloadStatus mediaURLFetch = NOT_STARTED;
enum downloadStatus thumbnailDownloadStatus = NOT_STARTED;
enum downloadStatus mediaFilesDownloadStatus = NOT_STARTED;
enum downloadStatus mediaURLFetch;
enum downloadStatus thumbnailDownloadStatus;
enum downloadStatus mediaFilesDownloadStatus;
std::string thumbnailImageData; // Thumbnail cache, this will contain the entire image.
std::string thumbnailImageUrl;

View file

@ -94,6 +94,7 @@ void BadgeComponent::setBadges(const std::vector<BadgeInfo>& badges)
// Save the visibility status to know whether any badges changed.
for (auto& item : mFlexboxItems) {
prevVisibility[item.label] = item.visible;
if (item.overlayImage.getTexture() != nullptr)
prevController[item.label] = item.overlayImage.getTexture()->getTextureFilePath();
item.visible = false;
}
@ -112,8 +113,12 @@ void BadgeComponent::setBadges(const std::vector<BadgeInfo>& badges)
continue;
it->visible = true;
if (badge.gameController != "" &&
badge.gameController != it->overlayImage.getTexture()->getTextureFilePath()) {
std::string texturePath;
if (it->overlayImage.getTexture() != nullptr)
texturePath = it->overlayImage.getTexture()->getTextureFilePath();
if (badge.gameController != "" && badge.gameController != texturePath) {
auto it2 = std::find_if(sGameControllers.begin(), sGameControllers.end(),
[badge](GameControllers gameController) {