Skip to content

Commit c160035

Browse files
authored
fix: Context-related errors generated at runtime with early intialization (#264)
1 parent 03d2721 commit c160035

File tree

3 files changed

+5
-1
lines changed

3 files changed

+5
-1
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
### Fixes
1010

1111
- Allow configuration script to run even if SDK is initially disabled in project settings ([#258](https://github.com/getsentry/sentry-godot/pull/258))
12+
- Fixed context-related errors generated at runtime with early intialization ([#264](https://github.com/getsentry/sentry-godot/pull/264))
1213

1314
## 1.0.0-alpha.1
1415

src/sentry/contexts.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,9 @@ Dictionary make_device_context(const Ref<RuntimeConfig> &p_runtime_config) {
108108

109109
Dictionary make_device_context_update() {
110110
Dictionary device_context = Dictionary();
111+
ERR_FAIL_NULL_V(DisplayServer::get_singleton(), device_context);
112+
ERR_FAIL_NULL_V(OS::get_singleton(), device_context);
113+
111114
int primary_screen = DisplayServer::get_singleton()->get_primary_screen();
112115
device_context["orientation"] = _screen_orientation_as_string(primary_screen);
113116

src/sentry/sentry_sdk.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,6 @@ void SentrySDK::_initialize() {
281281
}
282282

283283
internal_sdk->initialize(_get_global_attachments());
284-
_init_contexts();
285284

286285
if (SentryOptions::get_singleton()->is_logger_enabled()) {
287286
logger.instantiate();
@@ -380,6 +379,7 @@ SentrySDK::SentrySDK() {
380379
#endif
381380

382381
if (SentryOptions::get_singleton()->get_configuration_script().is_empty() || Engine::get_singleton()->is_editor_hint()) {
382+
// Early initialization path.
383383
_initialize();
384384
// Delay contexts initialization until the engine singletons are ready.
385385
callable_mp(this, &SentrySDK::_init_contexts).call_deferred();

0 commit comments

Comments
 (0)