Apple Inc. faces risks from an expected slowdown in tech spending, but it’s still the safest play among consumer-hardware names, according to Morgan Stanley.

“While low- and mid-range consumer spending data points have been deteriorating for months,” Morgan Stanley analyst Erik Woodring noted that high-end spending has been more resilient. That could change, however, as he wrote that “the risks of a pullback at even the high-end consumer are rising,” given decades-high inflation levels and weakening consumer confidence.

The possibility of slowing tech spending among more affluent customers is “a growing risk to consumer hardware companies,” according to Woodring, given that the wealthiest quintile in the U.S. accounts for perhaps more than 40% of spending on consumer hardware products.

“When we layer in the above-trendline spending patterns in consumer electronics over the last two years, and the discretionary nature of most consumer electronics purchases, a slowdown in high-end spending is likely to have a significant impact on consumer electronics demand,” he wrote.

Apple AAPL is now Morgan Stanley’s only overweight-rated consumer hardware stock, after his recent analysis prompted a downgrade of Sonos Inc.’s shares SONO to equal weight from overweight. On Sonos, Woodring and his team like the company’s “strong product portfolio and differentiated growth flywheel” but also worry about the prospect of a general spending slowdown, which could make multiple expansion or positive estimate revisions less likely.

FactSet, MarketWatch

As for Apple, Woodring still expects that estimates need to fall to better acknowledge the changing spending landscape, but he sees the smartphone giant as best positioned to outperform in the consumer-hardware sector.

“Broadly speaking, we are OW [overweight] consumer hardware companies with sticky/loyal customer bases, less ‘discretionary’ products, and [that] have the ability to invest through cycles,” he wrote.

Apple has been more insulated from economic downturns in the past, he continued, though “it would be shortsighted to believe Apple is completely immune to a weaker consumer” given that Apple’s year-over-year revenue growth is highly correlated to “changes in U.S. consumer net worth, particularly the top two quintiles.”

Shares of Apple are up 1.3% in Wednesday trading. They’ve dropped 13.3% over the past three months as the Dow Jones Industrial Average DJIA has declined 9.0%.