As seen in bug 1585114, the array that is passed to the provideProcess() method of nsIContentProcessProvider can contain nulls, if there is a process that is in the middle of being shut down. The two non-trivial implementations of that method in ProcessSelector.jsm don't deal with that, so they end up failing.
A clean fix would be to not pass nulls in the array we pass to provideProcess(), but that would require some additional work to map the index that provideProcess() returns to the list of content parents in C++. It would also require figuring out what exactly the max count argument is, and how that should be adjusted.
The simple fix would be to add null checks to the two implementations in ProcessSelector.jsm and just leave the C++ alone.
(While this issue is part of what was going wrong in bug 1585114, the fix I landed there should be sufficient to fix the intermittent failure.)