fixed fileaccess error

This commit is contained in:
2025-03-25 10:20:08 +01:00
parent 91d592c484
commit 3c1d5c9e8f
2 changed files with 5 additions and 0 deletions

View File

@@ -226,6 +226,10 @@ void DiscordUtil::delete_tokens()
ConfigFile DiscordUtil::get_tokens(String encryption_key) ConfigFile DiscordUtil::get_tokens(String encryption_key)
{ {
ConfigFile config; ConfigFile config;
if (!FileAccess::file_exists("user://discord_data.binary"))
{
return ConfigFile();
}
Error err = config.load_encrypted_pass("user://discord_data.binary", encryption_key); Error err = config.load_encrypted_pass("user://discord_data.binary", encryption_key);
if (err != OK) if (err != OK)
{ {

View File

@@ -9,6 +9,7 @@
#include <godot_cpp/core/class_db.hpp> #include <godot_cpp/core/class_db.hpp>
#include <godot_cpp/variant/utility_functions.hpp> #include <godot_cpp/variant/utility_functions.hpp>
#include <godot_cpp/classes/config_file.hpp> #include <godot_cpp/classes/config_file.hpp>
#include <godot_cpp/classes/file_access.hpp>
using namespace godot; using namespace godot;