{"record":{"id":"482c1d2f2979baa5","repo":"Unity-Technologies/UnityCsReference","slug":"windowcontent","errorCode":null,"errorMessage":"windowContent","messagePattern":"windowContent","errorType":"exception","errorClass":"ArgumentNullException","httpStatus":null,"severity":"error","filePath":"Editor/Mono/GUI/PopupWindowWithoutFocus.cs","lineNumber":29,"sourceCode":"using Unity.Scripting.LifecycleManagement;\n\nnamespace UnityEditor\n{\n    partial class PopupWindowWithoutFocus : PopupWindow\n    {\n        [AutoStaticsCleanupOnCodeReload]\n        static PopupWindowWithoutFocus s_PopupWindowWithoutFocus;\n        bool hasBeenFocused = false;\n\n        public new static void Show(Rect activatorRect, PopupWindowContent windowContent)\n        {\n            Show(activatorRect, windowContent, null);\n        }\n\n        internal new static void Show(Rect activatorRect, PopupWindowContent windowContent, PopupLocation[] locationPriorityOrder)\n        {\n            if (windowContent == null)\n                throw new System.ArgumentNullException(nameof(windowContent));\n\n            if (s_PopupWindowWithoutFocus != null)\n            {\n                s_PopupWindowWithoutFocus.Close();\n                s_PopupWindowWithoutFocus = null;\n            }\n\n            if (ShouldShowWindow(activatorRect))\n            {\n                if (s_PopupWindowWithoutFocus == null)\n                    s_PopupWindowWithoutFocus = CreateInstance<PopupWindowWithoutFocus>();\n\n                s_PopupWindowWithoutFocus.Init(activatorRect, windowContent, locationPriorityOrder, ShowMode.PopupMenu, false);\n            }\n            else\n            {\n                windowContent.OnClose();\n            }","sourceCodeStart":11,"sourceCodeEnd":47,"githubUrl":"https://github.com/Unity-Technologies/UnityCsReference/blob/225b0fbdb57cc17d094e8056b71f8314aba56f73/Editor/Mono/GUI/PopupWindowWithoutFocus.cs#L11-L47","documentation":"PopupWindowWithoutFocus.Show throws ArgumentNullException(nameof(windowContent)) when the PopupWindowContent argument is null. The popup requires a content object to render, so a null content is rejected at the boundary rather than opening an empty window.","triggerScenarios":"Calling Show with a PopupWindowContent that evaluated to null (a factory returned null, a conditional content path was skipped, or a field was never assigned).","commonSituations":"Conditional popup content that returns null when there is nothing to show; refactoring that drops the content argument; passing a not-yet-constructed content.","solutions":["Return early when content is null instead of calling Show.","Ensure the content factory never returns null; provide a fallback content.","Null-check at the call site before invoking Show."],"exampleFix":"// before\nPopupWindowWithoutFocus.Show(rect, content);\n// after\nif (content != null)\n    PopupWindowWithoutFocus.Show(rect, content);","handlingStrategy":"type-guard","validationCode":"if (windowContent != null)\n    PopupWindowWithoutFocus.Show(rect, windowContent);","typeGuard":"static bool HasContent(PopupWindowContent c) => c != null;","tryCatchPattern":null,"preventionTips":["Null-check popup content before Show; treat null as 'nothing to display'.","Ensure content factories return a non-null instance or a documented fallback."],"tags":["imgui","popup","argument-null","unity-editor"],"backgroundTag":null,"analyzedSha":"225b0fbdb57cc17d094e8056b71f8314aba56f73","analyzedAt":"2026-08-13T19:07:19.849Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}