How to prevent must clause not being added into bool query if it has null value in Java API Client

I have a simple SearchRequest using the new elasticsearch Java API Client Library.

return SearchRequest.of(sr -> sr
                .index("myIndex")
                .query(q -> q
                        .bool(b -> b                                                          
                                .must(myCustomBoolQuery1)
                                .must(myCustomRangeQuery1)
                                .must(myCustomMatchQuery1)
                                
                        )
                )

How can I prevent adding myCustomRangeQuery1 if it is null?