Skip to content

Commit a841bb0

Browse files
committed
Better error message in C API
1 parent ec77897 commit a841bb0

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

crates/top/rerun_c/src/video.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@ pub extern "C" fn rr_video_asset_read_frame_timestamps_nanos(
1616
CError::unexpected_null("video_bytes").write_error(error);
1717
return std::ptr::null_mut();
1818
}
19+
if video_bytes_len == 0 {
20+
CError::new(CErrorCode::VideoLoadError, "Zero video bytes").write_error(error);
21+
return std::ptr::null_mut();
22+
}
1923
let Some(alloc_func) = alloc_func else {
2024
CError::unexpected_null("alloc_func").write_error(error);
2125
return std::ptr::null_mut();
@@ -44,7 +48,7 @@ pub extern "C" fn rr_video_asset_read_frame_timestamps_nanos(
4448
Err(err) => {
4549
CError::new(
4650
CErrorCode::VideoLoadError,
47-
&format!("Failed to play video: {err}"),
51+
&format!("Failed to load video: {err}"),
4852
)
4953
.write_error(error);
5054
return std::ptr::null_mut();

0 commit comments

Comments
 (0)