unity nullreferenceexception for Preview window

NullReferenceException: Object reference not set to an instance of an object
UnityEditor.PreviewWindow.OnDisable () (at C:/buildslave/unity/build/Editor/Mono/Inspector/PreviewWindow.cs:28)
UnityEditor.WindowLayout:LoadWindowLayout(String, Boolean)

I don’t know what this means, I look every where for an error.

I had the same problem after upgrading Unity and opening an old project. Just do: “Window>Layouts>Revert Factory Settings.”

my problem occurred again when i change UI layout again.

“Window>Layouts>Save Layouts…” fixed it for me. ,For me, the problem continues when i changed UI layout again.

"Window>Layouts>Save Layouts..." Fixed my issue.