Skip to content

500 Internal Server Error when updating item icon #1493

Description

@miguelcr1982

When updating an item icon in Heimdall for an item without a password, the app returns a 500 Internal Server Error. The logs show the following trace:

Attempt to read property "password" on null at ItemController.php:315

Steps to reproduce:

  1. Create an item without a password.
  2. Update the item (for example, change the icon) without entering a password.
  3. Observe the error in logs.

Expected behavior:
Updating an item icon without a password should not crash. The stored password should be preserved if it exists, or left as null if no password was previously set.

Additional information / Suggested fix:
The error occurs because storedConfigObject can be null if the item’s description is empty. Adding a null check around the password property prevents the crash:

if ($storedConfigObject && property_exists($storedConfigObject, 'password')) {
$configObject->password = $storedConfigObject->password;
} else {
$configObject->password = null;
}

Thank you for maintaining Heimdall, it’s a great project!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    Status
    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions