-
Notifications
You must be signed in to change notification settings - Fork 11
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
Crash when editing optional enum flag in Vexilographer #113
Comments
I have noticed in |
Perhaps I'm holding it wrong? |
I note that if I make the Simulator.Screen.Recording.-.iPhone.14.Pro.-.2023-07-05.at.17.01.42.mp4 |
I feel like the last problem could perhaps be addressed or improved by #112 |
Pretty sure the crash occurs here: Vexil/Sources/Vexil/Sources/UserDefaults+FlagValueSource.swift Lines 43 to 51 in 6b8a039
One way to stop the crash would be to use if value.boxedFlagValue.object == NSNull() {
set(nil, forKey: key)
} else {
set(value.boxedFlagValue.object, forKey: key)
} This doesn't quite work for setting optional values though. It simply removes the flag rather than setting it to A small change to @orj Here's a branch with the above changes. Any chance you could give it a test drive and make sure it doesn't break anything else? I was only testing with an optional case iterable control too. |
@orj Oh I missed this message. Didn't realise you had already figured it out :P Not sure if the above fix is suitable but it's been working okay with the |
The double-optional problem is something I also encountered but never bothered to investigate: #109 so if deemed suitable your solution would fix a few |
@huwr I'm guessing some more work would need to be done with the text editor to get it working fully. I haven't used it much but I remember having a hard time with optional numbers. |
Optional
enum
flags seem to Crash Vexilographer when going into edit mode.Vexil version:
2.2.1
Swift version:
swift-driver version: 1.75.2 Apple Swift version 5.8.1 (swiftlang-5.8.0.124.5 clang-1403.0.22.11.100)
Environment: Version 14.3.1 (14E300c)
✅ Checklist
- [ ] If possible, I've reproduced the issue using themain
branch of this package🔢 Steps to Reproduce
Replace this paragraph with an explanation of how to reproduce the incorrect behavior. This could include a code listing for a reduced version of your command, or a link to the code that is exhibiting the issue.
🎯 Expected behavior
No crash. Things work as expected.
🕵️♀️ Actual behavior
I have defined a flag like this:
The
ApplicationUserMode
is defined as:When trying to edit this in Vexilographer it crashes with the following stack trace.
The text was updated successfully, but these errors were encountered: