With worries about the SARS-CoV-2 virus at fever pitch, investors are running for the hills, sending stocks plummeting. Apple (NASDAQ:AAPL) is no exception. Shares are down 9.5% since the company issued an earnings warning last week because of COVID-19, which is approaching a pandemic level.

But that decline in shares of the iPhone maker could present an opportunity for investors to build a position in Apple. Yes, the problem is worsening, and Apple already warned investors about lower results for the current fiscal second quarter -- but there are reasons to be optimistic about Apple's prospects over the long haul.

Chinese flag with the words Wuhan Coronavirus Outbreak, and an arrow and stock chart heading downward

Source: Getty Images.

Demand isn't going away, it's just delayed

When Apple issued its fiscal second-quarter earnings warning, it expected a slower ramp-up in production after the Chinese New Year because of coronavirus. With factories shuttered and employees sick, the company's ability to churn out products is limited. Many of Apple's and its partners' stores are closed, also weighing on shares.

With the outbreak raging on, and concerns growing that COVID-19 may have begun spreading in the U.S., it's understandable that investors are nervous. The epidemic is the reason the markets have been tumbling this week, and shares of Apple have been under pressure. If it lasts longer than expected and becomes more widespread, it could result in Apple reporting a really ugly second quarter in which it loses billions of dollars in sales.

But there's a silver lining, so investors shouldn't panic. The issues are supply-related rather than demand-driven. When Apple issued an earnings warning at the start of 2019, it was because of a lack of demand, particularly in China; iPhone sales were suffering because not enough consumers wanted to pay up for the latest mobile device from Apple. This time around, business was booming in China, and would have continued to do so if not for the novel coronavirus.

Outside of China, Apple said demand across all its products and service categories has been strong and in line with expectations. If demand outside of China can offset the weakness more than Wall Street is forecasting for the second quarter, Apple shares could get a lift.

The more likely scenario is that sales Apple would have recorded during the current quarter will appear in the quarter ending in June. That's typically a seasonally slow period for Apple, and it could use that time to catch up on demand and get the supply chain back in order.

It could drive iPhone 12 sales

There's no question Apple is losing sales of the iPhone 11 because of COVID-19, but that may create a situation where more consumers purchase its upcoming iPhone 12 5G model. The company is expected to launch its first 5G phone in the fall, ushering in what many on Wall Street are calling a "supercycle" for Apple. That supercycle could get a bigger boost if more consumers who were prevented from purchasing an iPhone 11 by the epidemic instead purchase an iPhone 12. If that proves true, the coronavirus would become a timing issue for Apple, and the stock is likely to be rewarded.

It's one of the reasons Morgan Stanley said this week that it's buying Apple's shares on the weakness. The Wall Street firm maintained its $368 price target, implying more than 30% upside. In addition to the 5G iPhone, Morgan Stanley pointed to Apple's services and wearable units as driving growth.

Even Warren Buffett, whose Berkshire Hathaway (NYSE:BRK.A) (NYSE:BRK.B) is Apple's largest shareholder with 245 million shares (a 5.7% stake), doesn't see the COVID-19 coronavirus outbreak as a reason to unload shares of good companies. He told CNBC that investors shouldn't react in the short term, but that if there's an opportunity to buy good stocks at depressed levels, then they're in luck. As for Apple, Buffett said it's "probably the best business I know in the world." That's quite an endorsement -- and another reason why investors can benefit from Apple's current weakness.