Index: trunk/src/org/openstreetmap/josm/gui/MainApplication.java
===================================================================
--- trunk/src/org/openstreetmap/josm/gui/MainApplication.java	(revision 18560)
+++ trunk/src/org/openstreetmap/josm/gui/MainApplication.java	(revision 18561)
@@ -857,4 +857,9 @@
             contentPanePrivate = (JComponent) contentPane;
         }
+        // This should never happen, but it does. See #22183.
+        // Hopefully this code block will be temporary until we figure out what is actually going on.
+        if (!GraphicsEnvironment.isHeadless() && contentPanePrivate == null) {
+            throw new JosmRuntimeException("MainFrame contentPane is " + (contentPane == null ? "null" : contentPane.getClass().getName()));
+        }
         mainPanel = mainFrame.getPanel();
 
