Skip to content

Commit

Permalink
Fix option 0 interpreted as user cancelled
Browse files Browse the repository at this point in the history
  • Loading branch information
diegodlh committed Sep 26, 2024
1 parent ad8cdef commit ed2f16f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/cita/citations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,7 @@ export default class {
args,
orphanedActionSelection,
);
if (!orphanedActionSelection.value) {
if (orphanedActionSelection.value == undefined) {
// user cancelled
progress.newLine(
"error",
Expand Down

2 comments on commit ed2f16f

@diegodlh
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry! Meant to submit this as a pull request but pushed it directly instead. My bad.

@Dominic-DallOsto could you please check if this makes sense to you too? 0297759 fixed #290 but it introduced a bug too. Because it was checked whether orphanedActionSelection.value was falsy to decide whether the user had cancelled, this not only evaluated to false when it was undefined (user had cancelled) but also when it was 0 (user chose option 0: "keep").

I think explicitly checking if it's undefined should fix it.

@Dominic-DallOsto
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good!

Please sign in to comment.