Gasoline has an upper and lower explosive limit of 2% to 7%. What this means is by storing it in a moderately well sealed container it quickly becomes too rich to support combustion.
Hydrogen is 4% to 75%. This means almost any concentration of hydrogen and oxygen is flammable.
I should have responded to your original comment - hydrogen and batteries have very different potential range of applications and both of them have a place in the future of our energy systems.
To your flammability point - yes that is true - there are other advantages to Hydrogen being that it lighter than air and dissipates relatively quickly (diffusing the explosion risk) and that it is no toxic. Where as in the case of a car accident gasoline pools underneath the car and remains on site and a continued risk.
There are disadvantages to Hydrogen as well - the flammability has to be managed, its a pernicious molecule and causes embrittlement. All solvable through engineering.
Hydrogen is 4% to 75%. This means almost any concentration of hydrogen and oxygen is flammable.