Yes, a stopped heart shows up as a flat line with no activity on an EKG. We don't shock people when their hearts have completely stopped because it doesn't do anything and can actually damage the heart. Defibrillators are named that because they're intended to shock a heart that is in a chaotic electric rhythm called fibrillation where the heart is just kind of shivering instead of beating fully.
If a person has flatlined, you can do CPR and administer epinephrine, and if you're extremely lucky get their heart to start fibrillating so a shock might have a chance of being effective at restoring a normal heart beat. This is why someone whose heart has stopped completely is 2-3 times less likely to survive CPR than a person experiencing fibrillation.
I love the rhythm of this language. "Honga Tonga Honga Ha'apai" is so much fun to say.