mirror of
https://github.com/moonlight-stream/moonlight-qt.git
synced 2026-11-28 00:34:26 +00:00
Update AppModel, ComputerModel, and StreamUtil asserts to cover negative indices
This commit is contained in:
1 parent
2d600c4e6b
commit
4e8fc3aead
3 files changed
+13
-13
No files matched your search
@@ -13,7 +13,7 @@ void AppModel::initialize(ComputerManager* computerManager, int computerIndex, b
|
||||
connect(m_ComputerManager, &ComputerManager::computerStateChanged,
|
||||
this, &AppModel::handleComputerStateChanged);
|
||||
|
||||
Q_ASSERT(computerIndex < m_ComputerManager->getComputers().count());
|
||||
Q_ASSERT(computerIndex >= 0 && computerIndex < m_ComputerManager->getComputers().count());
|
||||
m_Computer = m_ComputerManager->getComputers().at(computerIndex);
|
||||
m_CurrentGameId = m_Computer->currentGameId;
|
||||
m_ShowHiddenGames = showHiddenGames;
|
||||
@@ -41,7 +41,7 @@ QString AppModel::getRunningAppName()
|
||||
|
||||
Session* AppModel::createSessionForApp(int appIndex)
|
||||
{
|
||||
Q_ASSERT(appIndex < m_VisibleApps.count());
|
||||
Q_ASSERT(appIndex >= 0 && appIndex < m_VisibleApps.count());
|
||||
NvApp app = m_VisibleApps.at(appIndex);
|
||||
|
||||
return new Session(m_Computer, app);
|
||||
@@ -73,7 +73,7 @@ QVariant AppModel::data(const QModelIndex &index, int role) const
|
||||
if (!index.isValid())
|
||||
return QVariant();
|
||||
|
||||
Q_ASSERT(index.row() < m_VisibleApps.count());
|
||||
Q_ASSERT(index.row() >= 0 && index.row() < m_VisibleApps.count());
|
||||
NvApp app = m_VisibleApps.at(index.row());
|
||||
|
||||
switch (role)
|
||||
@@ -207,7 +207,7 @@ void AppModel::updateAppList(QVector<NvApp> newList)
|
||||
|
||||
void AppModel::setAppHidden(int appIndex, bool hidden)
|
||||
{
|
||||
Q_ASSERT(appIndex < m_VisibleApps.count());
|
||||
Q_ASSERT(appIndex >= 0 && appIndex < m_VisibleApps.count());
|
||||
int appId = m_VisibleApps.at(appIndex).id;
|
||||
|
||||
{
|
||||
@@ -226,7 +226,7 @@ void AppModel::setAppHidden(int appIndex, bool hidden)
|
||||
|
||||
void AppModel::setAppDirectLaunch(int appIndex, bool directLaunch)
|
||||
{
|
||||
Q_ASSERT(appIndex < m_VisibleApps.count());
|
||||
Q_ASSERT(appIndex >= 0 && appIndex < m_VisibleApps.count());
|
||||
int appId = m_VisibleApps.at(appIndex).id;
|
||||
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user