# AU without GUI crashes

**URL:** <https://forum.juce.com/t/au-without-gui-crashes/11374>\
**Category:** Audio Plugins\
**Created:** [August 30, 2013, 6:32am UTC](https://forum.juce.com/t/au-without-gui-crashes/11374 "2013-08-30T06:32:36Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![ckk](https://avatars.discourse-cdn.com/v4/letter/c/d26b3c/32.png) [@ckk](https://forum.juce.com/u/ckk)\
**Post date:** [August 30, 2013, 6:32am UTC](https://forum.juce.com/t/au-without-gui-crashes/11374/1 "2013-08-30T06:32:36Z")

</div>

Hi Jules,

I downloaded the tip yesterday from GitHub and noticed that an AU crashes if no GUI is present (e.g. if createEditor() returns nullptr).

The current code is this (line 1235 in juce\_AU\_Wrapper.mm):

```auto
if (juceFilter != nullptr)
{
  deleteUI();

  AudioProcessorEditor* editorComp = juceFilter->createEditorIfNeeded();
  editorComp->setOpaque (true);
  windowComp = new ComponentInHIView (editorComp, mCarbonPane);
}
```

Which should be changed to something like this:

```auto
if (juceFilter != nullptr && juceFilter->hasEditor())
{
  deleteUI();

  AudioProcessorEditor* editorComp = juceFilter->createEditorIfNeeded();
                
  if (editorComp != nullptr)
  {
    editorComp->setOpaque (true);
    windowComp = new ComponentInHIView (editorComp, mCarbonPane);
  }
}
```

The plugin won’t crashes then, but still creates an empty window. I haven’t looked closer whether current AUs won’t allow a plugin without GUI or whether additional steps are necessary to signal the host the it has to supply the interface.

Edit: The blank window appears in Reaper but not in Logic, so I assume it is a reaper issue.

Chris

---

<div class="post-metadata">

**Author:** ![jules](https://avatars.discourse-cdn.com/v4/letter/j/41988e/32.png) [@jules](https://forum.juce.com/u/jules)\
**Post date:** [August 30, 2013, 8:25am UTC](https://forum.juce.com/t/au-without-gui-crashes/11374/2 "2013-08-30T08:25:55Z")

</div>

Drat. That code was written to assume&nbsp;that the host wouldn't call CreateUI if the plugin is gui-less, but I guess I need to make sure it can survive being called - thanks!

BTW..&nbsp;Tip for C++ ninjas: whenever you see a statement like that, you should get into the habit of always writing it&nbsp;this way:

```
if (AudioProcessorEditor* editorComp = juceFilter->createEditorIfNeeded())
{
    editorComp->setOpaque (true);
    windowComp = new ComponentInHIView (editorComp, mCarbonPane);
}
```

(..reasons why&nbsp;explained in the juce&nbsp;coding standard pages!)
