    });
  
    for (auto &destination : destinations) {
      auto widget = new DestinationWidget(this);
      widget->set(destination.get(), false);
  
      QObject::connect(widget, &QPushButton::clicked, [this, dest = destination->toJson()]() {
        navigateTo(dest);
        emit closeSettings();
      });
  
      destinations_layout->addWidget(widget);
 
</s> remove   for (auto &destination : destinations) {
 </s> add  </s> remove     else if (a->isFavorite()) return true;
    else if (b->isFavorite()) return false;
    return false;
  });
 </s> add     if (dest == current_destination) continue; </s> remove     if (!current_destination) return;
 </s> add     if (current_destination.empty()) return; </s> remove   // Sort: HOME, WORK, alphabetical FAVORITES, and then most recent (as returned by API)
  std::stable_sort(destinations.begin(), destinations.end(), [](const auto &a, const auto &b) {
    if (a->isFavorite() && b->isFavorite()) {
      if (a->label() == NAV_FAVORITE_LABEL_HOME) return true;
      else if (b->label() == NAV_FAVORITE_LABEL_HOME) return false;
      else if (a->label() == NAV_FAVORITE_LABEL_WORK) return true;
      else if (b->label() == NAV_FAVORITE_LABEL_WORK) return false;
      else return a->name() < b->name();
 </s> add   bool has_home = false, has_work = false;
  for (auto location : current_locations) {
    auto dest = location.toObject();
    if (dest["save_type"].toString() == NAV_TYPE_FAVORITE) {
      has_home = has_home || dest["label"].toString() == NAV_FAVORITE_LABEL_HOME;
      has_work = has_work || dest["label"].toString() == NAV_FAVORITE_LABEL_WORK; </s> remove     int index = !has_home || (current_destination && current_destination->isFavorite() && current_destination->label() == NAV_FAVORITE_LABEL_HOME) ? 0 : 1;
 </s> add     int index = !has_home || (current_destination["save_type"] == NAV_TYPE_FAVORITE && current_destination["label"] == NAV_FAVORITE_LABEL_HOME) ? 0 : 1;
    widget->set(dest, false);
    QObject::connect(widget, &QPushButton::clicked, [this, dest]() {
    });
  
    for (auto &destination : destinations) {
      auto widget = new DestinationWidget(this);
    widget->set(dest, false);
    QObject::connect(widget, &QPushButton::clicked, [this, dest]() {
    widget->set(dest, false);
    QObject::connect(widget, &QPushButton::clicked, [this, dest]() {
    widget->set(dest, false);
    QObject::connect(widget, &QPushButton::clicked, [this, dest]() {
        navigateTo(dest);
        emit closeSettings();
      });
  
      destinations_layout->addWidget(widget);
keep keep keep keep replace replace replace keep keep keep keep keep
 ui/MapSettings: sort location JsonArray inplace (#28886) 
selfdrive/ui/qt/maps/map_settings.cc