File tree Expand file tree Collapse file tree 1 file changed +12
-2
lines changed Expand file tree Collapse file tree 1 file changed +12
-2
lines changed Original file line number Diff line number Diff line change @@ -182,10 +182,20 @@ pub fn create_surface(
182182 let ( raw_window_handle, raw_display_handle) = {
183183 use raw_window_handle:: { WaylandDisplayHandle , WaylandWindowHandle } ;
184184
185- let window_handle_ptr = unsafe { NonNull :: new_unchecked ( window_handle as * mut c_void ) } ;
185+ if window_handle == 0 {
186+ return Err ( error:: ProcessingError :: HandleError (
187+ HandleError :: Unavailable ,
188+ ) ) ;
189+ }
190+ let window_handle_ptr = NonNull :: new ( window_handle as * mut c_void ) . unwrap ( ) ;
186191 let window = WaylandWindowHandle :: new ( window_handle_ptr) ;
187192
188- let display_handle_ptr = unsafe { NonNull :: new_unchecked ( display_handle as * mut c_void ) } ;
193+ if display_handle == 0 {
194+ return Err ( error:: ProcessingError :: HandleError (
195+ HandleError :: Unavailable ,
196+ ) ) ;
197+ }
198+ let display_handle_ptr = NonNull :: new ( display_handle as * mut c_void ) . unwrap ( ) ;
189199 let display = WaylandDisplayHandle :: new ( display_handle_ptr) ;
190200
191201 (
You can’t perform that action at this time.
0 commit comments