It seems like the engineers would have known that the slightest spark would screw them.
I'll answer this question in two parts: how safe hydrogen really was, and what other alternatives there were.
For the first part, I think it is important to point out that hydrogen airships were a lot safer than nowadays perceived. Hydrogen by itself is not flammable and the "slightest spark" will not cause an airship to burst into flames. In fact, the Hindenburg was struck by lightning on multiple occasions during its career with no ill-effects, even when the lightning was fierce enough to burn holes in the cover of the airship. What is actually needed to produce a fire is a mixture of hydrogen and oxygen, which you will not find inside an airship (but can be produced if it has a leak). To help prevent this, large airships were not a single giant "balloon" as they may appear, but were compartmentalised into numerous smaller cells. Hydrogen also diffuses extremely fast through air (about four times faster than water vapour), which means any flammable atmosphere created by a leaky fuel cell will dissipate quite quickly. A disaster such as that which destroyed the Hindenburg could only happen through a combination of circumstances which caused an appreciably large leak of hydrogen from the fuel cells into the air and provided a nearby spark before the leak has dissipated.
This isn't to say that hydrogen airships are "safe" by modern standards, but they were far from as obviously dangerous as we might naively think, particularly in the context of a world where almost all forms of flight still carried a high degree of risk.
And what other options did the engineers have?
Hot air has been around since the very first lighter-than-air flight. However, this provides far less lift than hydrogen, and adds additional complications around the weight of the burner and fuel, making it very difficult to design a large airship around it. Indeed, a hot-air powered airship ("thermal airship") did not fly until relatively recently in 1973, and this was not an option available to the designers of the Hindenburg.
Helium is completely inert and offers almost as much lift as hydrogen (about 90% of the lifting force, which in practice means it can carry half the payload - a compromise but arguably acceptable given airships of the time did use it). However, helium is a rare and expensive gas mainly found in natural oil and gas reservoirs, and helium extraction was in its infancy during the 1920s. The first helium airship (USS Shenandoah, 1923) contained most of the world's reserves of helium at that time. Due to this scarcity the US (the world's main producer of helium other than the USSR) banned the export of helium, a ban which was still enforced when the Hindenburg was constructed and essentially rendered the gas unobtainable for its German builders. The Hindenburg had in fact been designed to use helium, and therefore may not have been entirely suitable for the hydrogen with which it was ultimately filled (which may or may not have contributed to the disaster, though the complete destruction of the airship in said disaster makes it difficult to confirm exactly what the causes were.
Heavier-than-air flight was also still very dangerous at the time, and could not achieve many of the things (long range and a high degree of comfort) that were the main selling points of airship travel. Airships could be used for intercontinental flights, whereas aeroplanes of the time still needed frequent stops for refuelling.
Ultimately, the airship industry was already firmly in decline when the Hindenburg disaster occurred, driven by steady improvements in heavier-than-air flight, high cost (exacerbated by the expense of helium), and by safety problems. A far bigger safety issue than hydrogen was the vulnerability of airships in bad weather - they were large and fragile enough to be torn apart or crashed by storm-force winds, yet also too slow and cumbersome to reliably evade approaching storms. The US Navy operated four Zeppelin-type airships, all helium, three of which were destroyed in stormy weather, including the above-mentioned Shenandoah.