Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Initialize variables that are potentially referenced before assignment in maintenance edit() view #2784

Merged
merged 2 commits into from
Dec 11, 2023

Conversation

lunkwill42
Copy link
Member

Due to the convoluted logic of the edit() function, multiple variables may be referenced before proper assignment unless they are given a value of None first.

Unfortunately, at least two such variables were potentially referenced without being initialized first.

This ensures all variables that may remain "unassigned" are initialized to None at the start of the function.

Fixes #2783

Due to the convoluted logic of the edit() function, multiple variables
may be referenced before proper assignment unless they are given a
value of `None` first.

Unfortunately, at least two such variables were potentially referenced
without being initialized first (among other things, causing the
crash mentioned in Uninett#2783).

This ensures all variables that may remain "unassigned" are initialized
to `None` at the start of the function.
@lunkwill42 lunkwill42 self-assigned this Dec 11, 2023
Copy link

sonarcloud bot commented Dec 11, 2023

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
No Duplication information No Duplication information

Copy link

codecov bot commented Dec 11, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (b51ca9d) 57.00% compared to head (1de2f9a) 57.01%.

Additional details and impacted files
@@            Coverage Diff             @@
##            5.8.x    #2784      +/-   ##
==========================================
+ Coverage   57.00%   57.01%   +0.01%     
==========================================
  Files         567      567              
  Lines       41277    41275       -2     
==========================================
+ Hits        23528    23532       +4     
+ Misses      17749    17743       -6     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link

Test results

     12 files       12 suites   11m 35s ⏱️
3 301 tests 3 301 ✔️ 0 💤 0
9 378 runs  9 378 ✔️ 0 💤 0

Results for commit 1de2f9a.

@hmpf hmpf self-requested a review December 11, 2023 11:10
@lunkwill42 lunkwill42 merged commit 6528958 into Uninett:5.8.x Dec 11, 2023
12 checks passed
@lunkwill42 lunkwill42 deleted the bugfix/maintenance-edit-crash branch December 11, 2023 12:50
@biselx
Copy link

biselx commented Dec 12, 2023

Great, good job.
Thank you

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.

3 participants