fix codeql

Signed-off-by: Trial97 <alexandru.tripon97@gmail.com>
This commit is contained in:
Trial97 2023-09-05 23:45:32 +03:00
parent 8bad255a91
commit 8c8e4329d7
No known key found for this signature in database
GPG Key ID: 55EF5DA53DB36318
3 changed files with 8 additions and 8 deletions

View File

@ -368,21 +368,21 @@ bool SkinList::setData(const QModelIndex& idx, const QVariant& value, int role)
return true; return true;
} }
void SkinList::updateSkin(SkinModel s) void SkinList::updateSkin(SkinModel* s)
{ {
auto done = false; auto done = false;
for (auto i = 0; i < m_skin_list.size(); i++) { for (auto i = 0; i < m_skin_list.size(); i++) {
if (m_skin_list[i].getPath() == s.getPath()) { if (m_skin_list[i].getPath() == s->getPath()) {
m_skin_list[i].setCapeId(s.getCapeId()); m_skin_list[i].setCapeId(s->getCapeId());
m_skin_list[i].setModel(s.getModel()); m_skin_list[i].setModel(s->getModel());
m_skin_list[i].setURL(s.getURL()); m_skin_list[i].setURL(s->getURL());
done = true; done = true;
break; break;
} }
} }
if (!done) { if (!done) {
beginInsertRows(QModelIndex(), m_skin_list.count(), m_skin_list.count() + 1); beginInsertRows(QModelIndex(), m_skin_list.count(), m_skin_list.count() + 1);
m_skin_list.append(s); m_skin_list.append(*s);
endInsertRows(); endInsertRows();
} }
save(); save();

View File

@ -58,7 +58,7 @@ class SkinList : public QAbstractListModel {
void save(); void save();
int getSelectedAccountSkin(); int getSelectedAccountSkin();
void updateSkin(SkinModel s); void updateSkin(SkinModel* s);
private: private:
// hide copy constructor // hide copy constructor

View File

@ -463,5 +463,5 @@ void SkinManageDialog::on_userBtn_clicked()
if (m_capes.contains(mcProfile.currentCape)) { if (m_capes.contains(mcProfile.currentCape)) {
s.setCapeId(mcProfile.currentCape); s.setCapeId(mcProfile.currentCape);
} }
m_list.updateSkin(s); m_list.updateSkin(&s);
} }