diff --git a/RequireJsNet/RequireJsOptions.cs b/RequireJsNet/RequireJsOptions.cs index 6cb7143..f5444a7 100644 --- a/RequireJsNet/RequireJsOptions.cs +++ b/RequireJsNet/RequireJsOptions.cs @@ -134,10 +134,15 @@ internal static string ConvertToJsObject(Dictionary options) var config = new StringBuilder(); config.Append("{"); - foreach (var item in options) + + if (options != null) { - config.AppendFormat(" {0}: {1}{2} ", item.Key, JsonConvert.SerializeObject(item.Value), options.Last().Equals(item) ? "" : ","); + foreach (var item in options) + { + config.AppendFormat(" {0}: {1}{2} ", item.Key, JsonConvert.SerializeObject(item.Value), options.Last().Equals(item) ? "" : ","); + } } + config.Append("}"); return config.ToString(); }