title: Get rid of 'argument is of length zero' error message in R console
body: <p>I have the shiny app below in which 2 numeric inputs are displayed. The app works fine since when the sum is not 40 an error message is displayed. What is annoying and I would like to get rid off is the error message </p>
  
  <pre><code>Warning: Error in if: argument is of length zero
  </code></pre>
  
  <p>which appears in the r console when I run the app for the 1st time. I know that this comes from <code>line 38</code> and has to do with the <code>NULL</code> values in the beginning. The interesting thing is thatthis error message is not displayed when I do not use <code>renderUI()</code> for the 2 numeric inputs. But I need them to be like this in my actual case.</p>
  
  <pre><code>library(shiny)
  
  ui &lt;- fluidPage(
    sidebarLayout(
      sidebarPanel(
        #This hides the temporary warning messages while the plots are being created
        tags$style(type="text/css",
                   ".shiny-output-error { visibility: hidden; }",
                   ".shiny-output-error:before { visibility: hidden; }"
        ),
        uiOutput("factors_weight_one_two"),
        htmlOutput('weight_message')
      ),
      mainPanel(
  
      )
    )
  )
  
  server &lt;- function(input, output) {
    output$factors_weight_one_two &lt;- renderUI({
      fluidRow(
        column(6, numericInput(
          "factors_weight_one",
          "Factor 1", 20, 
          min = 1, max = 100,
          width = "90%")),
        column(6, numericInput(
          "factors_weight_two",
          "Factor 2", 20, 
          min = 1, max = 100,
          width = "90%"))
      )
    })
    output$weight_message &lt;- renderText({
  
        if(!is.null(as.numeric(input$factors_weight_one) + as.numeric(input$factors_weight_two) ) &amp; as.numeric(input$factors_weight_one) + as.numeric(input$factors_weight_two)  != 40){
          sprintf('&lt;font color="%s"&gt;%s&lt;/font&gt;', 'red', "Your weights don't sum to 40")
        }  else {
          sprintf('&lt;font color="%s"&gt;%s&lt;/font&gt;', 'red', "")
        }
  
    })
  
  }
  
  shinyApp(ui, server)
  </code></pre>