Skip to content

Commit 017cf87

Browse files
committed
Return null for empty path
1 parent 6ff3797 commit 017cf87

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/sentry_attachment.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,14 @@ void SentryAttachment::_bind_methods() {
1818
}
1919

2020
Ref<SentryAttachment> SentryAttachment::create_with_path(const String &p_path, const String &p_content_type) {
21+
ERR_FAIL_COND_V_MSG(p_path.is_empty(), Ref<SentryAttachment>(), "Sentry: Can't create attachment with an empty file path.");
22+
2123
#ifdef NATIVE_SDK
2224
Ref<SentryAttachment> attachment = memnew(NativeAttachment);
2325
#else
2426
Ref<SentryAttachment> attachment = memnew(DisabledAttachment);
2527
#endif
28+
2629
attachment->set_file_path(p_path);
2730
attachment->set_content_type(p_content_type);
2831
return attachment;

0 commit comments

Comments
 (0)