Skip to content

Commit e937c76

Browse files
committed
possibly fix #181
1 parent 05514ef commit e937c76

1 file changed

Lines changed: 15 additions & 0 deletions

File tree

drop-down.android.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -331,11 +331,21 @@ function initializeDropDownAdapter() {
331331
}
332332

333333
public getCount() {
334+
// In some strange situations owner can become null (see #181)
335+
if (!this.owner) {
336+
return 0;
337+
}
338+
334339
const owner = this.owner.get();
335340
return (owner && owner.items ? owner.items.length : 0) + 1; // +1 for the hint
336341
}
337342

338343
public getItem(i: number) {
344+
// In some strange situations owner can become null (see #181)
345+
if (!this.owner) {
346+
return "";
347+
}
348+
339349
const owner = this.owner.get();
340350

341351
if (i === 0) {
@@ -363,6 +373,11 @@ function initializeDropDownAdapter() {
363373
}
364374

365375
private _generateView(index: number, convertView: android.view.View, parent: android.view.ViewGroup, realizedViewType: RealizedViewType): android.view.View {
376+
// In some strange situations owner can become null (see #181)
377+
if (!this.owner) {
378+
return null;
379+
}
380+
366381
const owner = this.owner.get();
367382

368383
if (!owner) {

0 commit comments

Comments
 (0)