Added null checks

This commit is contained in:
acidicoala
2026-01-14 19:34:00 +05:00
parent 077096b7ed
commit 7b54b4bc7b
5 changed files with 10 additions and 8 deletions

View File

@@ -1,6 +1,6 @@
cmake_minimum_required(VERSION 3.24) cmake_minimum_required(VERSION 3.24)
project(SmokeAPI VERSION 4.1.1) project(SmokeAPI VERSION 4.1.3)
include(KoalaBox/cmake/KoalaBox.cmake) include(KoalaBox/cmake/KoalaBox.cmake)
add_subdirectory(KoalaBox) add_subdirectory(KoalaBox)

View File

@@ -224,7 +224,10 @@ namespace {
if(const auto lib_bitness = kb::lib::get_bitness(lib_path)) { if(const auto lib_bitness = kb::lib::get_bitness(lib_path)) {
if(static_cast<uint8_t>(*lib_bitness) == kb::platform::bitness) { if(static_cast<uint8_t>(*lib_bitness) == kb::platform::bitness) {
if(const auto lib_handle = kb::lib::load(lib_path)) { if(const auto lib_handle = kb::lib::load(lib_path)) {
LOG_INFO("Found original library: {}", kb::path::to_str(lib_path)); LOG_INFO(
"Found & loaded original library '{}' @ {}",
kb::path::to_str(lib_path), *lib_handle
);
original_steamapi_handle = *lib_handle; original_steamapi_handle = *lib_handle;
proxy_exports::init(self_module_handle, original_steamapi_handle); proxy_exports::init(self_module_handle, original_steamapi_handle);

View File

@@ -15,7 +15,9 @@ namespace steam_client {
if(interface_version) { if(interface_version) {
LOG_DEBUG("{} -> '{}' @ {}", function_name, interface_version, interface); LOG_DEBUG("{} -> '{}' @ {}", function_name, interface_version, interface);
steam_interfaces::hook_virtuals(interface, interface_version); if(interface) {
steam_interfaces::hook_virtuals(interface, interface_version);
}
} }
return interface; return interface;

View File

@@ -237,13 +237,10 @@ namespace steam_interfaces {
continue; continue;
} }
const auto* const interface_ptr = ISteamClient_GetISteamGenericInterface( ISteamClient_GetISteamGenericInterface(
ARGS(steam_user, steam_pipe, interface_version.c_str()) ARGS(steam_user, steam_pipe, interface_version.c_str())
); );
if(not interface_ptr) {
LOG_ERROR("Failed to get generic interface: '{}'", interface_version)
}
} }
} catch(const std::exception& e) { } catch(const std::exception& e) {
LOG_ERROR("{} -> Unhandled exception: {}", __func__, e.what()); LOG_ERROR("{} -> Unhandled exception: {}", __func__, e.what());