comparison src/madplug/plugin.c @ 653:638b290641f3 trunk

[svn] - madplug: check that text is not null before using g_strtod
author giacomo
date Thu, 15 Feb 2007 05:10:08 -0800
parents b9167008fc3f
children e6a1ba5185ba
comparison
equal deleted inserted replaced
652:7f865e3cd285 653:638b290641f3
79 */ 79 */
80 const gchar *text; 80 const gchar *text;
81 gdouble x; 81 gdouble x;
82 82
83 text = config->pregain_db; 83 text = config->pregain_db;
84 x = g_strtod(text, NULL); 84 if ( text != NULL )
85 x = g_strtod(text, NULL);
86 else
87 x = 0;
85 config->pregain_scale = (x != 0) ? pow(10.0, x / 20) : 1; 88 config->pregain_scale = (x != 0) ? pow(10.0, x / 20) : 1;
86 #ifdef DEBUG 89 #ifdef DEBUG
87 g_message("pregain=[%s] -> %g -> %g", text, x, config->pregain_scale); 90 g_message("pregain=[%s] -> %g -> %g", text, x, config->pregain_scale);
88 #endif 91 #endif
89 text = config->replaygain.default_db; 92 text = config->replaygain.default_db;
90 x = g_strtod(text, NULL); 93 if ( text != NULL )
94 x = g_strtod(text, NULL);
95 else
96 x = 0;
91 config->replaygain.default_scale = (x != 0) ? pow(10.0, x / 20) : 1; 97 config->replaygain.default_scale = (x != 0) ? pow(10.0, x / 20) : 1;
92 #ifdef DEBUG 98 #ifdef DEBUG
93 g_message("RG.default=[%s] -> %g -> %g", text, x, 99 g_message("RG.default=[%s] -> %g -> %g", text, x,
94 config->replaygain.default_scale); 100 config->replaygain.default_scale);
95 #endif 101 #endif