Skip to content

Commit b209f49

Browse files
committed
fix: ensure the fix works on Linux
1 parent 92569ca commit b209f49

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

src/endstone/runtime/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ if (UNIX)
5858
find_package(libelf REQUIRED)
5959
target_link_libraries(endstone_runtime PRIVATE libelf::libelf)
6060
target_link_options(endstone_runtime PRIVATE -g -Wl,--no-undefined,--exclude-libs,ALL)
61-
target_compile_options(endstone_runtime PRIVATE -O2 -DNDEBUG -g -fvisibility=hidden -fms-extensions)
61+
target_compile_options(endstone_runtime PRIVATE -O2 -DNDEBUG -g -fvisibility=hidden -fms-extensions -fno-delete-null-pointer-checks)
6262
if (ENDSTONE_SEPARATE_DEBUG_INFO)
6363
add_custom_command(
6464
TARGET endstone_runtime

src/endstone/runtime/bedrock_hooks/certificate.cpp

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,17 @@ UnverifiedCertificate UnverifiedCertificate::fromString(const std::string &input
3636
return {WebToken(), nullptr};
3737
}
3838

39+
namespace {
40+
template <typename T>
41+
bool validate_ptr(T *ptr)
42+
{
43+
return ptr != nullptr;
44+
}
45+
} // namespace
46+
3947
bool Certificate::validate(std::time_t current_time, bool is_self_signed, bool check_expired)
4048
{
41-
auto* self = std::launder(this);
42-
if (self == nullptr) {
49+
if (std::launder(this) == nullptr) {
4350
return false;
4451
}
4552
return ENDSTONE_HOOK_CALL_ORIGINAL(&Certificate::validate, this, current_time, is_self_signed, check_expired);

0 commit comments

Comments
 (0)