Skip to content

Fix crash when editing profile for non-existent user#11875

Open
mowems wants to merge 3 commits intopubliclab:mainfrom
mowems:fix-profile-edit-crash
Open

Fix crash when editing profile for non-existent user#11875
mowems wants to merge 3 commits intopubliclab:mainfrom
mowems:fix-profile-edit-crash

Conversation

@mowems
Copy link
Copy Markdown

@mowems mowems commented Apr 27, 2026

Fix: Prevent crash when editing non-existent user profile

Problem

Accessing /profile/:id/edit with a non-existent username caused a server error due to @user being nil.

Solution

Added a guard clause in UsersController#edit to handle cases where the user is not found.

Result

The application now redirects safely with an error message instead of crashing.

Testing

  • Visited /profile/fakeuser/edit
  • Confirmed no server error occurs

@mowems mowems requested a review from a team as a code owner April 27, 2026 08:19
@mowems
Copy link
Copy Markdown
Author

mowems commented Apr 27, 2026

It looks like the CI failures might be coming from deprecated GitHub Actions (for example actions/upload-artifact@v2), rather than anything introduced in this PR.

The changes here are focused on handling non-existent users in the profile edit flow, and everything is working as expected locally.

Happy to take a look at the workflow files and open a separate PR to help fix the CI if that would be useful.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant