# Color.SelectedFromDialog Reproducibly Crashing on macOS 11.3

**URL:** <https://forum.xojo.com/t/color-selectedfromdialog-reproducibly-crashing-on-macos-11-3/63371>\
**Category:** Bugs and Feature Requests\
**Created:** [May 15, 2021, 6:35am UTC](https://forum.xojo.com/t/color-selectedfromdialog-reproducibly-crashing-on-macos-11-3/63371 "2021-05-15T06:35:02Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![GarryPettet](https://forum.xojo.com/user_avatar/forum.xojo.com/garrypettet/32/31_2.png) [@GarryPettet](https://forum.xojo.com/u/GarryPettet)\
**Post date:** [May 15, 2021, 6:35am UTC](https://forum.xojo.com/t/color-selectedfromdialog-reproducibly-crashing-on-macos-11-3/63371/1 "2021-05-15T06:35:03Z")

</div>

Feedback Case Number: 64743.

This seems like a pretty serious bug for Mac users. I’m running Big Sur 11.3 on Apple Silicon.

`Color.SelectedFromDialog` reliably crashes any Xojo app when used as described in the Xojo docs.

Put this code in the action event of a button:

```xojo
Var c As Color = Color.Red
Call Color.SelectedFromDialog(c, "Choose Colour")

```

Click the button and choose a colour. Then close the picker window using the red close button. The app will crash with the debugger complaining about a `NilObjectException` on the `Call` line. The variable `c` is **not** Nil according to the debugger. No idea what is being set to `Nil` but the app will crash every single time.

As far as I can see, I have no way of selecting a colour on macOS 11.3.

Big bug.

---

<div class="post-metadata">

**Author:** ![Martin\_T](https://forum.xojo.com/letter_avatar_proxy/v4/letter/m/a88e57/32.png) [@Martin\_T](https://forum.xojo.com/u/Martin_T)\
**Post date:** [May 15, 2021, 6:43am UTC](https://forum.xojo.com/t/color-selectedfromdialog-reproducibly-crashing-on-macos-11-3/63371/2 "2021-05-15T06:43:23Z")

</div>

Morning @GarryPettet,

I think you have to use the “new” [DesktopColorPicker](http://documentation.xojo.com/api/user_interface/desktop/desktopcolorpicker.html) introduced in Xojo 2021r1.1 to prevent this exception. I imagine this was the reason for this new control.

---

<div class="post-metadata">

**Author:** ![GarryPettet](https://forum.xojo.com/user_avatar/forum.xojo.com/garrypettet/32/31_2.png) [@GarryPettet](https://forum.xojo.com/u/GarryPettet)\
**Post date:** [May 15, 2021, 7:15am UTC](https://forum.xojo.com/t/color-selectedfromdialog-reproducibly-crashing-on-macos-11-3/63371/3 "2021-05-15T07:15:17Z")

</div>

I seemed to have entirely missed that new control. Thanks for pointing it out @Martin_T.

Hopefully that’ll sort out my issue without having to hack my app too much…

---

<div class="post-metadata">

**Author:** ![DerkJ](https://forum.xojo.com/letter_avatar_proxy/v4/letter/d/e495f1/32.png) [@DerkJ](https://forum.xojo.com/u/DerkJ)\
**Post date:** [May 26, 2021, 1:32pm UTC](https://forum.xojo.com/t/color-selectedfromdialog-reproducibly-crashing-on-macos-11-3/63371/4 "2021-05-26T13:32:59Z")

</div>

This might be a solution on MacOS as it seems we get a NilObjectException but it’s working fine if that’s ignored.

```
Var SelectedColor As Color = &cFF0000 // Default red
Var SelectionChanged As Boolean

#Pragma BreakOnExceptions False
Try 
  SelectionChanged = Color.SelectedFromDialog(SelectedColor, "Profile Color")
Catch e As NilObjectException
  // We just ignore the NOE since it's still working...;)
Finally
  
  If SelectionChanged Then
    Self.Profile.ProfileColor = SelectedColor
    me.FillColor = SelectedColor
  End If
  
End Try
#Pragma BreakOnExceptions Default
```
