Spoiler alert: If you're a Downton Abbey addict and you missed Sunday's episode—or if you're just a little bit squeamish—this is your final warning to click away.

Last night on the British period drama, Lord Grantham's health mystery came to graphic fruition when he vomited blood across the dinner table, a potentially life-threatening consequence of his stomach ulcer. (You can catch a clip from the scene here. A heads up: it isn't pretty.)

The scene caused Health editors-slash-Downton fans to wonder: What the heck just happened—and can it happen to us?! We tapped our contributing medical editor, gastroenterologist Roshini Rajapaksa, MD, for the need-to-know facts on stomach ulcers.

The crater-like sores form when acid in the digestive tract eats away at the lining of the stomach or the duodenum (the first section of the small intestine), says Dr. Rajapaksa. "They're potentially very dangerous if left untreated."

The show's blood-spewing scene wasn't an unrealistic depiction of what can happen in an extreme case. "If the ulcer erodes deep enough into the lining of your stomach, two things can happen," Dr. Rajapaksa explains. "It can erode into a blood vessel, which then can start bleeding very profusely, and that's likely what happened in [Lord Grantham's] case, because he began vomiting blood. Or, it can actually erode a hole all the way through your stomach, and stomach contents can then leak into the abdominal cavity," a rare but potentially deadly scenario.

How do you get a stomach ulcer in the first place?

The primary cause is a bacteria known as Helicobacter pylori, which was just discovered in 1982. "Many people have the bacteria in their bodies, but may not realize it until later in life, if and when they develop gastritis, which is inflammation of the stomach, or an actual stomach ulcer," says Dr. Rajapaksa. (An estimated two-thirds of the world's population carries H. pylori.) Another possible cause of stomach ulcers is the long-term use of nonsteroidal anti-inflammatories, or NSAIDs, like ibuprofen and aspirin, she adds.

RELATED18 Reasons Why Your Stomach Hurts

How do you know if an ulcer is developing?

You may not if the sore is just opening and you're symptom-free, says Dr. Rajapaksa. But when an ulcer forms and deepens into the stomach lining, you'll feel it, she says. Common symptoms include burning pain and nausea, even vomiting in some cases. "You may also feel a gnawing feeling of hunger," Dr. Rajapaksa adds. "People with ulcers tend to feel a little bit better after they eat because food almost helps coat the stomach."

If you notice these signs, Dr. Rajapaksa recommends seeing your doctor a.s.a.p. "Certainly if you're vomiting blood, I would hope that everyone knows to immediately go to the hospital," she says. "But even if you're having other symptoms at home and you suspect you have an ulcer, I would suggest you get it diagnosed instead of trying to wait it out, or seeing if the pain goes away."

Ulcers can be diagnosed through with X-ray tests, an endoscopy (a nonsurgical procedure that involves inserting a flexible tube with a light and mini-camera through your mouth to look inside your digestive tract), or a simple breath test that detects whether you have the H. pylori bacteria.

RELATED13 Ways Inflammation Can Affect Your Health

Can you prevent stomach ulcers?

Unfortunately, if you have H. pylori in your body, there are few precautions you can take to avoid getting a stomach ulcer. Some people believe that avoiding spicy foods can help, or that stress triggers stomach ulcers—but those are myths, says Dr. Rajapaksa. She advises limiting your intake of NSAIDs (and not popping more than the recommended dose per day).

The key is to get checked out early, she says. "As soon as the ulcer is diagnosed, you can take an acid-blocking medication that will treat the erosion and prevent it from getting any worse in most cases. In more extreme cases, surgery may be required to repair the damage."