Fix Crash on dx12
If we couldn't initialize debug_controller, we would try to call Release
on a null ptr. Now only Release the debug_controller if we could get it
successfully.
@@ -603,10 +603,9 @@ impl Instance {
if winerror::SUCCEEDED(hr) {
unsafe { (*debug_controller).EnableDebugLayer() };
- }
-
unsafe { (*debug_controller).Release(); }
}
+ }
// Create DXGI factory
let mut dxgi_factory: *mut dxgi1_4::IDXGIFactory4 = ptr::null_mut();
