Skip to content

fix(AutomaticPlaceMapperJob): Do not fail when there are no users - #3148

Merged
provokateurin merged 1 commit into
masterfrom
fix/automatic-place-mapper-job/no-users
Sep 3, 2025
Merged

provokateurin merged 1 commit into
masterfrom
fix/automatic-place-mapper-job/no-users

Conversation

@provokateurin

Copy link
Copy Markdown
Member

With nextcloud/server#53212 it is possible that this job runs when there are no users on the instance.
Then $lastMappedUser = $users[array_key_first($users)]->getUID(); will produce the following crash:

{
  "Exception": "Error",
  "Message": "Call to a member function getUID() on null",
  "Code": 0,
  "Trace": [
    {
      "file": "/nix/store/n1lzxp2m7ffvqnzmbw4zr9bibx4mf5nq-nextcloud-32.0.0/lib/public/BackgroundJob/Job.php",
      "line": 61,
      "function": "run",
      "class": "OCA\\Photos\\Jobs\\AutomaticPlaceMapperJob",
      "type": "->",
      "args": [
        null
      ]
    },
    {
      "file": "/nix/store/n1lzxp2m7ffvqnzmbw4zr9bibx4mf5nq-nextcloud-32.0.0/lib/public/BackgroundJob/TimedJob.php",
      "line": 97,
      "function": "start",
      "class": "OCP\\BackgroundJob\\Job",
      "type": "->",
      "args": [
        {
          "__class__": "OC\\BackgroundJob\\JobList"
        }
      ]
    },
    {
      "file": "/nix/store/n1lzxp2m7ffvqnzmbw4zr9bibx4mf5nq-nextcloud-32.0.0/lib/public/BackgroundJob/TimedJob.php",
      "line": 84,
      "function": "start",
      "class": "OCP\\BackgroundJob\\TimedJob",
      "type": "->",
      "args": [
        {
          "__class__": "OC\\BackgroundJob\\JobList"
        }
      ]
    },
    {
      "file": "/nix/store/n1lzxp2m7ffvqnzmbw4zr9bibx4mf5nq-nextcloud-32.0.0/cron.php",
      "line": 175,
      "function": "execute",
      "class": "OCP\\BackgroundJob\\TimedJob",
      "type": "->",
      "args": [
        {
          "__class__": "OC\\BackgroundJob\\JobList"
        }
      ]
    }
  ],
  "File": "/nix/store/n1lzxp2m7ffvqnzmbw4zr9bibx4mf5nq-nextcloud-32.0.0/apps/photos/lib/Jobs/AutomaticPlaceMapperJob.php",
  "Line": 48,
  "message": "Error while running background job OCA\\Photos\\Jobs\\AutomaticPlaceMapperJob (id: 12, arguments: null)",
  "exception": {},
  "CustomMessage": "Error while running background job OCA\\Photos\\Jobs\\AutomaticPlaceMapperJob (id: 12, arguments: null)"
}

Backports are not necessary, since this can only occur on Nextcloud 32+

@provokateurin
provokateurin merged commit 327d4d2 into master Sep 3, 2025
@provokateurin
provokateurin deleted the fix/automatic-place-mapper-job/no-users branch September 3, 2025 10:13
@skjnldsv skjnldsv modified the milestones: Nextcloud 32, Nextcloud 33 Sep 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

3. to review Waiting for reviews bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants