@@ -188,21 +188,23 @@ class NoteDirectEditFragment : BaseNoteFragment(), Branded {
188188
189189 private fun loadNoteInWebView (note : Note ) {
190190 Log .d(TAG , " loadNoteInWebView() called" )
191- val directEditingRepository =
192- DirectEditingRepository .getInstance(requireContext().applicationContext)
193- val urlDisposable = directEditingRepository.getDirectEditingUrl(account, note)
194- .observeOn(AndroidSchedulers .mainThread()).subscribe({ url ->
195- url?.let {
196- if (BuildConfig .DEBUG ) {
197- Log .d(TAG , " loadNoteInWebView: url = $url " )
191+
192+ context?.let { context ->
193+ val repository = DirectEditingRepository .getInstance(context)
194+ val urlDisposable = repository.getDirectEditingUrl(account, note)
195+ .observeOn(AndroidSchedulers .mainThread()).subscribe({ url ->
196+ url?.let {
197+ if (BuildConfig .DEBUG ) {
198+ Log .d(TAG , " loadNoteInWebView: url = $url " )
199+ }
200+ binding.noteWebview.loadUrl(url)
198201 }
199- binding.noteWebview.loadUrl(url)
200- }
201- }, { throwable ->
202- handleLoadError()
203- Log .e(TAG , " loadNoteInWebView:" , throwable)
204- })
205- disposables.add(urlDisposable)
202+ }, { throwable ->
203+ handleLoadError()
204+ Log .e(TAG , " loadNoteInWebView:" , throwable)
205+ })
206+ disposables.add(urlDisposable)
207+ }
206208 }
207209
208210 private fun handleLoadError () {
0 commit comments