I'm not sure if this should be a bug report or a support request but I get this white screen error message when clicking on the 'Close Register' tab [/admin/commerce/pos/main]

The website encountered an unexpected error. Please try again later.
Error: Call to a member function close() on null in Drupal\commerce_pos\Controller\CloseRegister->content() (line 34 of modules/contrib/commerce_pos/src/Controller/CloseRegister.php).
Drupal\commerce_pos\Controller\CloseRegister->content()
call_user_func_array(Array, Array) (Line: 123)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 582)
Drupal\Core\Render\Renderer->executeInRenderContext(Object, Object) (Line: 124)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array) (Line: 97)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 151)
Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 68)
Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1) (Line: 57)
Drupal\Core\StackMiddleware\Session->handle(Object, 1, 1) (Line: 47)
Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object, 1, 1) (Line: 106)
Drupal\page_cache\StackMiddleware\PageCache->pass(Object, 1, 1) (Line: 85)
Drupal\page_cache\StackMiddleware\PageCache->handle(Object, 1, 1) (Line: 47)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object, 1, 1) (Line: 52)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 1, 1) (Line: 23)
Stack\StackedHttpKernel->handle(Object, 1, 1) (Line: 693)
Drupal\Core\DrupalKernel->handle(Object) (Line: 19)
CommentFileSizeAuthor
#2 3109520-2.patch881 bytesderekcresswell

Comments

the_glitch created an issue. See original summary.

derekcresswell’s picture

StatusFileSize
new881 bytes

@the_glitch
Could you provide any other details to reproduce this issue?

I was able to generate what seems to be the same error by deleting all my registers and then going to "/admin/commerce/pos/close-register" where I go a white page with "unexpected error" and the logs showed the same "close() on null". After the error persisted even when adding a register without opening.

Try out the patch I've attached and see if that fixes your issue. This will just check that there is a register to close before trying to close said register.

the_glitch’s picture

Hi Derek. The patch works. Thank you very.

derekcresswell’s picture

Status: Active » Reviewed & tested by the community

Great! Should be good to commit than, rather uncontroversial change.

smccabe’s picture

Status: Reviewed & tested by the community » Fixed

Thanks, committed.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.