Yes, it's hard to differentiate between courage and stupidity. And I do agree with this statement. But I also think the difference is the result.
Sometimes if we act courageous when the situation looks stupid, the result comes out positive. Then we are praised for being courageous. But if the result is negative, we are criticised for being stupid.