Managers: cleanup includes and add an assert.

This commit is contained in:
Guillaume Jacquemin 2024-04-08 11:17:48 +02:00
parent fbfcce1d86
commit 661f6acd12
Signed by: williamjcm
SSH key fingerprint: SHA256:AYLOg+iTV0ElElnlu4vqM4edFazVdRiuQB0Y5LoKc4A

View file

@ -14,10 +14,7 @@
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>. // along with this program. If not, see <https://www.gnu.org/licenses/>.
#include <cstdio>
#include <algorithm> #include <algorithm>
#include <chrono>
#include <Corrade/Containers/ScopeGuard.h> #include <Corrade/Containers/ScopeGuard.h>
#include <Corrade/Containers/StaticArray.h> #include <Corrade/Containers/StaticArray.h>
@ -25,8 +22,6 @@
#include <Corrade/Utility/Path.h> #include <Corrade/Utility/Path.h>
#include <Corrade/Utility/String.h> #include <Corrade/Utility/String.h>
#include <zip.h>
#include "../Configuration/Configuration.h" #include "../Configuration/Configuration.h"
#include "../Logger/Logger.h" #include "../Logger/Logger.h"
@ -103,6 +98,8 @@ ProfileManager::getProfile(std::size_t index) {
bool bool
ProfileManager::deleteProfile(std::size_t index, bool delete_builds) { ProfileManager::deleteProfile(std::size_t index, bool delete_builds) {
CORRADE_INTERNAL_ASSERT(index < _profiles.size());
if(!Utility::Path::remove(Utility::Path::join(conf().directories().gameSaves, _profiles[index].filename()))) { if(!Utility::Path::remove(Utility::Path::join(conf().directories().gameSaves, _profiles[index].filename()))) {
_lastError = Utility::format("Couldn't delete {} (filename: {}).", _lastError = Utility::format("Couldn't delete {} (filename: {}).",
_profiles[index].companyName(), _profiles[index].companyName(),