We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 3c62e22 commit 418fdf2Copy full SHA for 418fdf2
src/sdl2/render.rs
@@ -777,7 +777,8 @@ impl<'a> Renderer<'a> {
777
/// # Panics
778
/// Panics if drawing fails for any reason (e.g. driver failure),
779
/// or if the provided texture does not belong to the renderer.
780
- pub fn copy(&mut self, texture: &Texture, src: Option<Rect>, dst: Option<Rect>) {
+ pub fn copy(&mut self, texture: &Texture, src: Option<Rect>, dst: Option<Rect>)
781
+ -> Result<(), String> {
782
texture.check_renderer();
783
784
let ret = unsafe {
@@ -796,7 +797,9 @@ impl<'a> Renderer<'a> {
796
797
};
798
799
if ret != 0 {
- panic!("Error copying texture: {}", get_error())
800
+ Err(get_error())
801
+ } else {
802
+ Ok(())
803
}
804
805
0 commit comments