Minor bug in AudioFormatReader

AudioFormatReader::createReaderFor(…) seems to fail in a non-stop series of asserts if you inadvertently pass it a directory which ends in .wav!

{
    // you need to actually register some formats before the manager can
    // use them to open a file!
    jassert (getNumKnownFormats() > 0);

    for (auto* af : knownFormats)
        if (af->canHandleFile (file))
            if (auto in = file.createInputStream())
                if (auto* r = af->createReaderFor (in.release(), true))
                    return r;

    return nullptr;
}

It gets to createReaderFor with a valid value for in but then in createReaderFor it starts to go to hell. Not sure how createInputStream() succeeds on a directory to start with. This is on a Mac. Example assert is here:

int FileInputStream::read (void* buffer, int bytesToRead)
{
    // You should always check that a stream opened successfully before using it!
    jassert (openedOk());

Which is pretty weird as createInputStream should return only file input streams for which openedOk() returns true. Here’s a screenshot of the debugger showing the insides of the FileInputStream:

Presumably on POSIX you can open() a directory but not call read() on it so the openedOk() thing changes status after the attempt to read it?

I’m going to stop passing directories in, but might be good if JUCE handled this better.