Fix PPT disconnect null check crash (#413)

This commit is contained in:
CJK_mkp
2026-03-23 16:46:28 +08:00
committed by GitHub
parent 290e031f77
commit 2590ea5bdb
+14 -2
View File
@@ -1344,10 +1344,22 @@ namespace Ink_Canvas.Helpers
catch { } catch { }
} }
private static bool IsObjectNull(object comObject)
{
return ReferenceEquals(comObject, null);
}
private void DisconnectFromPPT() private void DisconnectFromPPT()
{ {
if (PPTApplication == null && _pptActivePresentation == null && _pptSlideShowWindow == null && object pptApplication = PPTApplication;
CurrentPresentation == null && CurrentSlides == null && CurrentSlide == null) object activePresentation = _pptActivePresentation;
object slideShowWindow = _pptSlideShowWindow;
object currentPresentation = CurrentPresentation;
object currentSlides = CurrentSlides;
object currentSlide = CurrentSlide;
if (IsObjectNull(pptApplication) && IsObjectNull(activePresentation) && IsObjectNull(slideShowWindow) &&
IsObjectNull(currentPresentation) && IsObjectNull(currentSlides) && IsObjectNull(currentSlide))
{ {
return; return;
} }