• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
Keine Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

Commit MetaInfo

Revision092657133f24dd545ca6d991bd12a281d98f9ac5 (tree)
Zeit2018-08-03 14:26:14
AutorHMML <hmml3939@gmai...>
CommiterHMML

Log Message

Handle exception on setting null weather icon image.

Ändern Zusammenfassung

Diff

--- a/app/build.gradle
+++ b/app/build.gradle
@@ -7,8 +7,8 @@ android {
77 applicationId "cloud.hmml.mmw"
88 minSdkVersion 17
99 targetSdkVersion 27
10- versionCode 8
11- versionName '0.4.4'
10+ versionCode 9
11+ versionName '0.4.5'
1212 testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
1313
1414 }
--- a/app/src/main/java/cloud/hmml/mmw/WeatherDispWidget.java
+++ b/app/src/main/java/cloud/hmml/mmw/WeatherDispWidget.java
@@ -59,10 +59,10 @@ public class WeatherDispWidget extends AppWidgetProvider {
5959
6060 if (conf.loadWeatherIdent(1) != null) {
6161 Bitmap icon = theme.getIconBitmap(conf.loadWeatherIdent(1));
62- if (metrics.widthPixels < icon.getWidth()) {
62+ if (icon != null && metrics.widthPixels < icon.getWidth()) {
6363 // resize if icon is bigger than twice to avoid memory limit exception...
6464 views.setImageViewBitmap(R.id.weather_image_today,
65- Bitmap.createScaledBitmap(icon, metrics.widthPixels/2, metrics.widthPixels * icon.getHeight() / icon.getWidth() / 2, true));
65+ Bitmap.createScaledBitmap(icon, metrics.widthPixels / 2, metrics.widthPixels * icon.getHeight() / icon.getWidth() / 2, true));
6666 } else {
6767 views.setImageViewBitmap(R.id.weather_image_today, icon);
6868 }
@@ -82,9 +82,9 @@ public class WeatherDispWidget extends AppWidgetProvider {
8282
8383 if (conf.loadWeatherIdent(2) != null) {
8484 Bitmap icon = theme.getIconBitmap(conf.loadWeatherIdent(2));
85- if (metrics.widthPixels < icon.getWidth()) {
85+ if (icon != null && metrics.widthPixels < icon.getWidth()) {
8686 views.setImageViewBitmap(R.id.weather_image_tomorrow,
87- Bitmap.createScaledBitmap(icon, metrics.widthPixels/2, metrics.widthPixels * icon.getHeight() / icon.getWidth() / 2, true));
87+ Bitmap.createScaledBitmap(icon, metrics.widthPixels / 2, metrics.widthPixels * icon.getHeight() / icon.getWidth() / 2, true));
8888 } else {
8989 views.setImageViewBitmap(R.id.weather_image_tomorrow, icon);
9090 }