Stability of the density-wave state of a dipolar condensate in a pancake-shaped trap