Safely access rstudio's api (when available)