Under the United States Constitution, specifically the 25th Amendment, there is a clear line of succession designed to maintain stability in the event a president can no longer serve.
If a sitting president were to die in office, the vice president would immediately assume the presidency after taking the official oath of office.