Describe the bug
When Exporting a Screenshot using the following settings:
Type - Entire Map.
Layers - Current View.
View - Player.
An error occurs that states the following:
screenCapture() caught:
java.lang.NullPointerException
With no further elaboration.
It does not appear to matter the size, type, or apparent settings of the current map, and this issue does not appear to occur when using the View - GM option.
Expected behavior
It is expected that the program simply exports a full image of the map as it is displayed using Player View.
Screenshots

MapTool Info
Desktop (please complete the following information):
I tried to replicate. I do not get an error message, however the screenshot isn't taken.
Also, when selecting "Entire Map" when FoW is enabled, and a token has revealed the FoW, the screenshot is taken as if that FoW had not been revealed:

Seems like the bugs only occur when "Entire Map" is selected.
Maybe the FoW is not properly recognized when option "Entire Map" is selected? This would explain why the view is dark for the GM view, and why nothing is generated by the player view.
The map in this campaign seems to produce a different but related bug.

(Remove .zip)
ExportNPETest.cmpgn.zip
Attempting the export with View: GM did produce an image but it was wrong as in your example.
@Phergus I think your error occurs on the first blank map when MapTool opens?
Wasn't blank. Had a single token with an exposed area. Just restarted MT and was able to get the OPs NPE message on Player View but no error with GM View.
Could not reproduce the error I first got.
The inconsistency of it is why it has never been fixed. I don't use it much but I normally do GM View exports and it mostly works fine that way.
More fiddling around with player view and was able to get the stack trace with current develop:
16:04:53.587 (MapTool.java:299) [AWT-EventQueue-0] ERROR net.rptools.maptool.client.MapTool - screenCapture() caught:
java.lang.NullPointerException: Cannot read field "x" because "r" is null
at java.awt.Component.setBounds(Component.java:2478) ~[?:?]
at net.rptools.maptool.client.ui.ExportDialog.postScreenshot(ExportDialog.java:864) ~[main/:?]
at net.rptools.maptool.client.ui.ExportDialog.screenCapture(ExportDialog.java:612) ~[main/:?]
at net.rptools.maptool.client.ui.ExportDialog.exportButtonAction(ExportDialog.java:521) ~[main/:?]
at net.rptools.maptool.client.ui.ExportDialog$1.actionPerformed(ExportDialog.java:413) ~[main/:?]
at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1967) ~[?:?]
at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2308) ~[?:?]
at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:405) ~[?:?]
at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:262) ~[?:?]
at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:279) ~[?:?]
at java.awt.Component.processMouseEvent(Component.java:6636) ~[?:?]
at javax.swing.JComponent.processMouseEvent(JComponent.java:3342) ~[?:?]
at java.awt.Component.processEvent(Component.java:6401) ~[?:?]
at java.awt.Container.processEvent(Container.java:2263) ~[?:?]
at java.awt.Component.dispatchEventImpl(Component.java:5012) ~[?:?]
at java.awt.Container.dispatchEventImpl(Container.java:2321) ~[?:?]
at java.awt.Component.dispatchEvent(Component.java:4844) ~[?:?]
at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4919) ~[?:?]
at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4548) ~[?:?]
at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4489) ~[?:?]
at java.awt.Container.dispatchEventImpl(Container.java:2307) ~[?:?]
at java.awt.Window.dispatchEventImpl(Window.java:2764) ~[?:?]
at java.awt.Component.dispatchEvent(Component.java:4844) ~[?:?]
at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:772) ~[?:?]
at java.awt.EventQueue$4.run(EventQueue.java:721) ~[?:?]
at java.awt.EventQueue$4.run(EventQueue.java:715) ~[?:?]
at java.security.AccessController.doPrivileged(AccessController.java:391) [?:?]
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:85) [?:?]
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:95) [?:?]
at java.awt.EventQueue$5.run(EventQueue.java:745) [?:?]
at java.awt.EventQueue$5.run(EventQueue.java:743) [?:?]
at java.security.AccessController.doPrivileged(AccessController.java:391) ~[?:?]
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:85) ~[?:?]
at java.awt.EventQueue.dispatchEvent(EventQueue.java:742) ~[?:?]
at net.rptools.maptool.client.swing.MapToolEventQueue.dispatchEvent(MapToolEventQueue.java:54) ~[main/:?]
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:203) ~[?:?]
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:124) ~[?:?]
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:117) ~[?:?]
at java.awt.WaitDispatchSupport$2.run(WaitDispatchSupport.java:190) ~[?:?]
at java.awt.WaitDispatchSupport$4.run(WaitDispatchSupport.java:235) ~[?:?]
at java.awt.WaitDispatchSupport$4.run(WaitDispatchSupport.java:233) ~[?:?]
at java.security.AccessController.doPrivileged(AccessController.java:312) ~[?:?]
at java.awt.WaitDispatchSupport.enter(WaitDispatchSupport.java:233) ~[?:?]
at java.awt.Dialog.show(Dialog.java:1070) ~[?:?]
at java.awt.Component.show(Component.java:1717) ~[?:?]
at java.awt.Component.setVisible(Component.java:1664) ~[?:?]
at java.awt.Window.setVisible(Window.java:1023) ~[?:?]
at java.awt.Dialog.setVisible(Dialog.java:1005) ~[?:?]
at net.rptools.maptool.client.ui.ExportDialog.setVisible(ExportDialog.java:457) ~[main/:?]
at net.rptools.maptool.client.AppActions$3.executeAction(AppActions.java:241) ~[main/:?]
at net.rptools.maptool.client.AppActions$ClientAction.execute(AppActions.java:3247) ~[main/:?]
at net.rptools.maptool.client.AppActions$ClientAction.actionPerformed(AppActions.java:3279) ~[main/:?]
at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1967) ~[?:?]
at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2308) ~[?:?]
at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:405) ~[?:?]
at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:262) ~[?:?]
at javax.swing.AbstractButton.doClick(AbstractButton.java:369) ~[?:?]
at de.muntjak.tinylookandfeel.TinyMenuItemUI.doClick(Unknown Source) ~[tinylaf-nocp-1.4.0.jar:?]
at de.muntjak.tinylookandfeel.TinyMenuItemUI$MouseInputHandler.mouseReleased(Unknown Source) ~[tinylaf-nocp-1.4.0.jar:?]
at java.awt.AWTEventMulticaster.mouseReleased(AWTEventMulticaster.java:297) ~[?:?]
at java.awt.Component.processMouseEvent(Component.java:6636) ~[?:?]
at javax.swing.JComponent.processMouseEvent(JComponent.java:3342) ~[?:?]
at java.awt.Component.processEvent(Component.java:6401) ~[?:?]
at java.awt.Container.processEvent(Container.java:2263) ~[?:?]
at java.awt.Component.dispatchEventImpl(Component.java:5012) ~[?:?]
at java.awt.Container.dispatchEventImpl(Container.java:2321) ~[?:?]
at java.awt.Component.dispatchEvent(Component.java:4844) ~[?:?]
at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4919) ~[?:?]
at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4548) ~[?:?]
at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4489) ~[?:?]
at java.awt.Container.dispatchEventImpl(Container.java:2307) ~[?:?]
at java.awt.Window.dispatchEventImpl(Window.java:2764) ~[?:?]
at java.awt.Component.dispatchEvent(Component.java:4844) ~[?:?]
at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:772) ~[?:?]
at java.awt.EventQueue$4.run(EventQueue.java:721) ~[?:?]
at java.awt.EventQueue$4.run(EventQueue.java:715) ~[?:?]
at java.security.AccessController.doPrivileged(AccessController.java:391) [?:?]
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:85) ~[?:?]
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:95) ~[?:?]
at java.awt.EventQueue$5.run(EventQueue.java:745) ~[?:?]
at java.awt.EventQueue$5.run(EventQueue.java:743) ~[?:?]
at java.security.AccessController.doPrivileged(AccessController.java:391) [?:?]
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:85) [?:?]
at java.awt.EventQueue.dispatchEvent(EventQueue.java:742) [?:?]
at net.rptools.maptool.client.swing.MapToolEventQueue.dispatchEvent(MapToolEventQueue.java:54) [main/:?]
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:203) [?:?]
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:124) [?:?]
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:113) [?:?]
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:109) [?:?]
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101) [?:?]
at java.awt.EventDispatchThread.run(EventDispatchThread.java:90) [?:?]
The variables origBounds & origScale start out null. If an exception occurs during the first time a screenshot is taken, they stay null and cause a NPE when postScreenshot() is ran inside a finally{}.
PR #1949 fixes this.
There is also the other issue mentioned by @Frennchy in Discord:
The Zoom level has to be at 100% or else it will not export with all of the objects regardless of how many there are.
Maybe the zoom should be set to 100% for the screenshot?
PR #1952 fixes the zoom issue.
Tested:
Additional note: Exporting Whole Map or Current View uses the current zoom level for exported image. To get a 1:1 rendering at pixels/grid you must have Zoom at 100%.