fix: handle null ports in Docker container table (#5313)

When Docker API returns `null` for container ports (instead of `[]`),
the Docker management page crashes. Added optional chaining on
`ports?.length` to handle this case.

Fixes #5311

Co-authored-by: Matt Van Horn <455140+mvanhorn@users.noreply.github.com>
This commit is contained in:
Matt Van HornandMatt Van Horn authored and GitHub committed 2026-03-27 20:04:03 +01:00
1 parent d53c922688
commit 1639da5779
4 files changed
+5 -3

No files matched your search

@@ -21,7 +21,7 @@ export const AddDockerAppToHomarrModal = createModal<AddDockerAppToHomarrProps>(
{
initialValues: {
containerUrls: innerProps.selectedContainers.map((container) => {
if (container.ports[0]) {
if (Array.isArray(container.ports) && container.ports[0]) {
return `http://${container.ports[0].IP}:${container.ports[0].PublicPort}`;
}