When a stock falls over a cliff after earnings, it can put investors into an unnerving situation: Should you average down, or simply get out of the stock entirely? It's not always an easy question to answer, especially since the markets can sometimes overreact to a bad quarter.

Diabetes specialist DexCom (DXCM -0.20%) saw its stock fall by over 40% just with the release of its latest earnings numbers. The sell-off might have you believe that the business is broken, or at least that it's in deep trouble. But is that really the case?

Let's take a look at whether DexCom is a stock to avoid or it's a good time to add it to your portfolio.

Why did DexCom's stock crash in July?

In the month of July, shares of DexCom were largely steady, until the company reported its latest earnings numbers. Those results came out on July 25, and to say investors weren't impressed would be a massive understatement. Revenue for the period ended June 30 totaled just over $1 billion, and it rose 15% year over year. While that's a decent double-digit growth rate, it has been trending in the wrong direction of late:

DXCM Revenue (Quarterly YoY Growth) Chart

DXCM Revenue (Quarterly YoY Growth) data by YCharts.

CEO Kevin Sayer admits that the company's "execution did not meet our high standards." And what's even more concerning is that DexCom is forecasting between $975 million and $1 billion in revenue for the current quarter. That would represent an organic growth rate of between just 1% and 3% -- an even more drastic slowdown in its top line.

A high valuation means investors expect a lot

If DexCom traded at a lower valuation, the recent growth numbers may not have turned off investors as badly as they did. But it hasn't been uncommon for the healthcare stock to trade at more than 100 times its trailing profits. Even with the recent sell-off, it's still arguably a bit pricey, trading at a price-to-earnings multiple of around 45:

DXCM PE Ratio Chart

DXCM PE Ratio data by YCharts.

Investors aren't thrilled with a big drop-off in revenue, especially when there isn't much confidence that the growth rate will recover. Among the reasons management said the performance wasn't all that strong were changes in its sales team. While those can have an impact, investors may be hesitant to buy that excuse given the magnitude of the change in DexCom's growth rate.

What investors may be growing concerned about is the role that glucagon-like peptide-1 (GLP-1) drugs are having on the business. DexCom's continuous glucose monitoring (CGM) devices help people with diabetes manage their glucose levels -- and GLP-1 drugs have been helping people lose significant amounts of weight, to the point where they may no longer need to take insulin or track their glucose levels with CGMs.

The size of the sell-off leads me to believe it's not just a slowdown in the growth rate and poor guidance, but that DexCom's long-term growth prospects may take a hit due to the success of GLP-1 drugs.

Should you consider investing in DexCom?

DexCom is coming off a bad quarter, and its guidance wasn't great for the current period, either. And concerns about GLP-1 drugs are warranted, given the impact they may have on the market for CGMs.

But I wouldn't throw in the towel on DexCom's stock just yet. People with diabetes still need to track their glucose levels, and staying on GLP-1 drugs long-term may not be sustainable due to possible side effects and the financial costs involved. The healthcare market is frenzied over GLP-1 medications, and any signs of weakness for a diabetes company such as DexCom could be seen as validation that the drugs are indeed disrupting the healthcare industry.

However, investors should be careful assuming that these headwinds will become permanent challenges for DexCom and other CGM device makers. There's still a significant need for CGMs in the long run, so you might want to consider buying shares of DexCom right now, while it's at a lower valuation. Although there is some risk and uncertainty ahead, the stock can make for a promising long-term investment to buy and hold.