@@ -91,29 +91,33 @@ class EventUtils {
9191 break ;
9292
9393 case "PushEvent" :
94- String ref = event.payload! .ref! ;
95- ref = ref.substring (ref.lastIndexOf ("/" ) + 1 );
96- actionStr = "Push to $ref at ${event .repo !.name !}" ;
94+ if (event.payload != null && event.payload? .ref != null ) {
95+ String ref = event.payload! .ref! ;
96+ ref = ref.substring (ref.lastIndexOf ("/" ) + 1 );
97+ actionStr = "Push to $ref at ${event .repo !.name !}" ;
9798
98- des = '' ;
99- String descSpan = '' ;
99+ des = '' ;
100+ String descSpan = '' ;
100101
101- int count = event.payload? .commits? .length ?? 0 ;
102- int maxLines = 4 ;
103- int max = count > maxLines ? maxLines - 1 : count;
102+ int count = event.payload? .commits? .length ?? 0 ;
103+ int maxLines = 4 ;
104+ int max = count > maxLines ? maxLines - 1 : count;
104105
105- for (int i = 0 ; i < max; i++ ) {
106- PushEventCommit commit = event.payload! .commits! [i];
107- if (i != 0 ) {
108- descSpan += ("\n " );
106+ for (int i = 0 ; i < max; i++ ) {
107+ PushEventCommit commit = event.payload! .commits! [i];
108+ if (i != 0 ) {
109+ descSpan += ("\n " );
110+ }
111+ String sha = commit.sha! .substring (0 , 7 );
112+ descSpan += sha;
113+ descSpan += " " ;
114+ descSpan += commit.message! ;
109115 }
110- String sha = commit.sha! .substring (0 , 7 );
111- descSpan += sha;
112- descSpan += " " ;
113- descSpan += commit.message! ;
114- }
115- if (count > maxLines) {
116- descSpan = "$descSpan \n ..." ;
116+ if (count > maxLines) {
117+ descSpan = "$descSpan \n ..." ;
118+ }
119+ } else {
120+ actionStr = "" ;
117121 }
118122 break ;
119123 case "ReleaseEvent" :
@@ -143,7 +147,10 @@ class EventUtils {
143147 return ;
144148 }
145149 NavigatorUtils .goReposDetail (
146- context, event.actor! .login! , repositoryName);
150+ context,
151+ event.actor! .login! ,
152+ repositoryName,
153+ );
147154 break ;
148155 case 'PushEvent' :
149156 if (event.payload! .commits == null ) {
@@ -152,17 +159,28 @@ class EventUtils {
152159 }
153160 NavigatorUtils .goReposDetail (context, owner, repositoryName);
154161 } else if (event.payload! .commits! .length == 1 ) {
155- NavigatorUtils .goPushDetailPage (context, owner, repositoryName,
156- event.payload! .commits! [0 ].sha, true );
162+ NavigatorUtils .goPushDetailPage (
163+ context,
164+ owner,
165+ repositoryName,
166+ event.payload! .commits! [0 ].sha,
167+ true ,
168+ );
157169 } else {
158170 StringList list = [];
159171 for (int i = 0 ; i < event.payload! .commits! .length; i++ ) {
160172 list.add (
161- "${event .payload !.commits ![i ].message !} ${event .payload !.commits ![i ].sha !.substring (0 , 4 )}" );
173+ "${event .payload !.commits ![i ].message !} ${event .payload !.commits ![i ].sha !.substring (0 , 4 )}" ,
174+ );
162175 }
163176 CommonUtils .showCommitOptionDialog (context, list, (index) {
164- NavigatorUtils .goPushDetailPage (context, owner, repositoryName,
165- event.payload! .commits! [index].sha, true );
177+ NavigatorUtils .goPushDetailPage (
178+ context,
179+ owner,
180+ repositoryName,
181+ event.payload! .commits! [index].sha,
182+ true ,
183+ );
166184 });
167185 }
168186 break ;
@@ -172,9 +190,13 @@ class EventUtils {
172190 break ;
173191 case 'IssueCommentEvent' :
174192 case 'IssuesEvent' :
175- NavigatorUtils .goIssueDetail (context, owner, repositoryName,
176- event.payload! .issue! .number.toString (),
177- needRightLocalIcon: true );
193+ NavigatorUtils .goIssueDetail (
194+ context,
195+ owner,
196+ repositoryName,
197+ event.payload! .issue! .number.toString (),
198+ needRightLocalIcon: true ,
199+ );
178200 break ;
179201 default :
180202 if (fullName.toLowerCase () == currentRepository.toLowerCase ()) {
0 commit comments